{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"8SVM-下 - 案例部分源码-处理地点.ipynb","version":"0.3.2","provenance":[{"file_id":"1B1n0cMBW9pnnkUFX2cqRt-4MPFgxYtYw","timestamp":1546767683047}],"collapsed_sections":[],"toc_visible":true},"kernelspec":{"name":"python3","display_name":"Python 3"},"accelerator":"GPU"},"cells":[{"metadata":{"id":"PeCgeTCDRGv_","colab_type":"text"},"cell_type":"markdown","source":["# 导库导数据，探索特征"]},{"metadata":{"id":"HqheAv7UJGtA","colab_type":"code","colab":{}},"cell_type":"code","source":["import pandas as pd\n","import numpy as np\n","from sklearn.model_selection import train_test_split"],"execution_count":0,"outputs":[]},{"metadata":{"id":"dn5uDt8UJGtL","colab_type":"code","colab":{}},"cell_type":"code","source":["weather = pd.read_csv(r\"weatherAUS5000.csv\",index_col=0)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"HPCOiTLJJGtR","colab_type":"code","outputId":"a8e2d683-e052-4d8a-b19d-fd95de6d24a5","executionInfo":{"status":"ok","timestamp":1546770788951,"user_tz":-480,"elapsed":788,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["weather.head()"],"execution_count":3,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainTomorrow</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-03-24</td>\n","      <td>Adelaide</td>\n","      <td>12.3</td>\n","      <td>19.3</td>\n","      <td>0.0</td>\n","      <td>5.0</td>\n","      <td>NaN</td>\n","      <td>S</td>\n","      <td>39.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>59.0</td>\n","      <td>47.0</td>\n","      <td>1022.2</td>\n","      <td>1021.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>15.1</td>\n","      <td>17.7</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2011-07-12</td>\n","      <td>Adelaide</td>\n","      <td>7.9</td>\n","      <td>11.4</td>\n","      <td>0.0</td>\n","      <td>1.0</td>\n","      <td>0.5</td>\n","      <td>N</td>\n","      <td>20.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>7.0</td>\n","      <td>70.0</td>\n","      <td>59.0</td>\n","      <td>1028.7</td>\n","      <td>1025.7</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>8.4</td>\n","      <td>11.3</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-02-08</td>\n","      <td>Adelaide</td>\n","      <td>24.0</td>\n","      <td>38.1</td>\n","      <td>0.0</td>\n","      <td>23.4</td>\n","      <td>13.0</td>\n","      <td>SE</td>\n","      <td>39.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>36.0</td>\n","      <td>24.0</td>\n","      <td>1018.0</td>\n","      <td>1016.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>32.4</td>\n","      <td>37.4</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2016-09-19</td>\n","      <td>Adelaide</td>\n","      <td>6.7</td>\n","      <td>16.4</td>\n","      <td>0.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>N</td>\n","      <td>31.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>65.0</td>\n","      <td>40.0</td>\n","      <td>1014.4</td>\n","      <td>1010.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>11.2</td>\n","      <td>15.9</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2014-03-05</td>\n","      <td>Adelaide</td>\n","      <td>16.7</td>\n","      <td>24.8</td>\n","      <td>0.0</td>\n","      <td>6.6</td>\n","      <td>11.7</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>61.0</td>\n","      <td>48.0</td>\n","      <td>1019.3</td>\n","      <td>1018.9</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>20.8</td>\n","      <td>23.7</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["         Date  Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0  2015-03-24  Adelaide     12.3     19.3       0.0          5.0       NaN   \n","1  2011-07-12  Adelaide      7.9     11.4       0.0          1.0       0.5   \n","2  2010-02-08  Adelaide     24.0     38.1       0.0         23.4      13.0   \n","3  2016-09-19  Adelaide      6.7     16.4       0.4          NaN       NaN   \n","4  2014-03-05  Adelaide     16.7     24.8       0.0          6.6      11.7   \n","\n","  WindGustDir  WindGustSpeed WindDir9am      ...      WindSpeed3pm  \\\n","0           S           39.0          S      ...              19.0   \n","1           N           20.0        NNE      ...               7.0   \n","2          SE           39.0        NNE      ...              19.0   \n","3           N           31.0          N      ...              15.0   \n","4           S           37.0          S      ...              24.0   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0         59.0         47.0       1022.2       1021.4       NaN       NaN   \n","1         70.0         59.0       1028.7       1025.7       NaN       NaN   \n","2         36.0         24.0       1018.0       1016.0       NaN       NaN   \n","3         65.0         40.0       1014.4       1010.0       NaN       NaN   \n","4         61.0         48.0       1019.3       1018.9       NaN       NaN   \n","\n","   Temp9am  Temp3pm  RainTomorrow  \n","0     15.1     17.7            No  \n","1      8.4     11.3            No  \n","2     32.4     37.4            No  \n","3     11.2     15.9            No  \n","4     20.8     23.7            No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":3}]},{"metadata":{"id":"jOjE-29tJGta","colab_type":"code","colab":{}},"cell_type":"code","source":["#将特征矩阵和标签Y分开\n","X = weather.iloc[:,:-1]\n","Y = weather.iloc[:,-1]"],"execution_count":0,"outputs":[]},{"metadata":{"id":"itMoBsYPJGtk","colab_type":"code","colab":{}},"cell_type":"code","source":["#分裂的快捷键：ctrl shift -\n","\n","#合并的快捷键：shift M"],"execution_count":0,"outputs":[]},{"metadata":{"id":"8-xZ99MXJGtw","colab_type":"code","outputId":"ba9793ed-86db-44f5-de9a-3dfe01f6422c","executionInfo":{"status":"ok","timestamp":1546770794309,"user_tz":-480,"elapsed":1130,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["X.shape #5000行是我随机选的"],"execution_count":5,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(5000, 21)"]},"metadata":{"tags":[]},"execution_count":5}]},{"metadata":{"id":"Lpx25hbrJGt5","colab_type":"code","outputId":"cab40989-75ff-44c4-dff0-4a4781fa33a9","executionInfo":{"status":"ok","timestamp":1546770795382,"user_tz":-480,"elapsed":648,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":459}},"cell_type":"code","source":["#探索数据类型\n","X.info()"],"execution_count":6,"outputs":[{"output_type":"stream","text":["<class 'pandas.core.frame.DataFrame'>\n","Int64Index: 5000 entries, 0 to 4999\n","Data columns (total 21 columns):\n","Date             5000 non-null object\n","Location         5000 non-null object\n","MinTemp          4979 non-null float64\n","MaxTemp          4987 non-null float64\n","Rainfall         4950 non-null float64\n","Evaporation      2841 non-null float64\n","Sunshine         2571 non-null float64\n","WindGustDir      4669 non-null object\n","WindGustSpeed    4669 non-null float64\n","WindDir9am       4651 non-null object\n","WindDir3pm       4887 non-null object\n","WindSpeed9am     4949 non-null float64\n","WindSpeed3pm     4919 non-null float64\n","Humidity9am      4936 non-null float64\n","Humidity3pm      4880 non-null float64\n","Pressure9am      4506 non-null float64\n","Pressure3pm      4504 non-null float64\n","Cloud9am         3111 non-null float64\n","Cloud3pm         3012 non-null float64\n","Temp9am          4967 non-null float64\n","Temp3pm          4912 non-null float64\n","dtypes: float64(16), object(5)\n","memory usage: 859.4+ KB\n"],"name":"stdout"}]},{"metadata":{"id":"1iHNfydVJGuC","colab_type":"code","outputId":"d39d0572-a82d-4419-bb4b-d8f2de37e57e","executionInfo":{"status":"ok","timestamp":1546770798931,"user_tz":-480,"elapsed":787,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":391}},"cell_type":"code","source":["#探索缺失值\n","X.isnull().mean() #缺失值所占总值的比例 isnull().sum(全部的True)/X.shape[0]\n","#我们要有不同的缺失值填补策略"],"execution_count":7,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Date             0.0000\n","Location         0.0000\n","MinTemp          0.0042\n","MaxTemp          0.0026\n","Rainfall         0.0100\n","Evaporation      0.4318\n","Sunshine         0.4858\n","WindGustDir      0.0662\n","WindGustSpeed    0.0662\n","WindDir9am       0.0698\n","WindDir3pm       0.0226\n","WindSpeed9am     0.0102\n","WindSpeed3pm     0.0162\n","Humidity9am      0.0128\n","Humidity3pm      0.0240\n","Pressure9am      0.0988\n","Pressure3pm      0.0992\n","Cloud9am         0.3778\n","Cloud3pm         0.3976\n","Temp9am          0.0066\n","Temp3pm          0.0176\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":7}]},{"metadata":{"id":"dlnYcQHRJGuN","colab_type":"code","colab":{}},"cell_type":"code","source":["#在上方添加一个新的cell ESC a enter"],"execution_count":0,"outputs":[]},{"metadata":{"id":"hrP2PM_3JGuT","colab_type":"code","colab":{}},"cell_type":"code","source":["#在下方添加一个新的cell ESC b enter"],"execution_count":0,"outputs":[]},{"metadata":{"id":"vkoG0MvIJGu6","colab_type":"code","colab":{}},"cell_type":"code","source":["#删除一个cell ESC d d"],"execution_count":0,"outputs":[]},{"metadata":{"id":"_HjB3B6DRB9K","colab_type":"text"},"cell_type":"markdown","source":["# 分集，优先探索标签"]},{"metadata":{"id":"amA4CV0rJGu-","colab_type":"code","outputId":"9bc1c3a5-1801-42fe-af6b-ce31ad89c536","executionInfo":{"status":"ok","timestamp":1546770802994,"user_tz":-480,"elapsed":1004,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Y.shape"],"execution_count":8,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(5000,)"]},"metadata":{"tags":[]},"execution_count":8}]},{"metadata":{"id":"E2aTsn0MJGvE","colab_type":"code","outputId":"3031af01-153f-4c75-9ea2-6fec5407a059","executionInfo":{"status":"ok","timestamp":1546770804648,"user_tz":-480,"elapsed":533,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Y.isnull().sum() #加和的时候，True是1，False是0"],"execution_count":9,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0"]},"metadata":{"tags":[]},"execution_count":9}]},{"metadata":{"id":"LDFm0wfPP2iR","colab_type":"code","outputId":"a69e1547-9ece-4a22-a177-4d114471d3d2","executionInfo":{"status":"ok","timestamp":1546762822104,"user_tz":-480,"elapsed":2341,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["type(Y)"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["pandas.core.series.Series"]},"metadata":{"tags":[]},"execution_count":23}]},{"metadata":{"id":"APUpqTx-QePi","colab_type":"code","outputId":"87e19b75-c2ca-4968-964a-c2f5531477b6","executionInfo":{"status":"ok","timestamp":1546762982247,"user_tz":-480,"elapsed":686,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Y.unique()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array(['No', 'Yes'], dtype=object)"]},"metadata":{"tags":[]},"execution_count":24}]},{"metadata":{"id":"M7AzOmClJGvP","colab_type":"code","outputId":"6df51b8c-c12e-430e-d3a0-a1c47845fba8","executionInfo":{"status":"ok","timestamp":1546762003889,"user_tz":-480,"elapsed":706,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["#探索标签的分类\n","np.unique(Y) #我们的标签是二分类"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array(['No', 'Yes'], dtype=object)"]},"metadata":{"tags":[]},"execution_count":10}]},{"metadata":{"id":"7wC3yvWtJGvX","colab_type":"code","colab":{}},"cell_type":"code","source":["#分训练集和测试集\n","Xtrain, Xtest, Ytrain, Ytest = train_test_split(X,Y,test_size=0.3,random_state=420) #随机抽样"],"execution_count":0,"outputs":[]},{"metadata":{"id":"9VSyWCFuJGvb","colab_type":"code","outputId":"d969f5be-73fb-4c7d-f4ac-8d8e21575a4f","executionInfo":{"status":"ok","timestamp":1546770811570,"user_tz":-480,"elapsed":797,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":11,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed9am</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>1809</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>4176</th>\n","      <td>2016-12-10</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>7.0</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","    </tr>\n","    <tr>\n","      <th>110</th>\n","      <td>2010-04-18</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","    </tr>\n","    <tr>\n","      <th>3582</th>\n","      <td>2009-11-26</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","    </tr>\n","    <tr>\n","      <th>2162</th>\n","      <td>2014-04-25</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 21 columns</p>\n","</div>"],"text/plain":["            Date     Location  MinTemp  MaxTemp  Rainfall  Evaporation  \\\n","1809  2015-08-24    Katherine     17.5     36.0       0.0          8.8   \n","4176  2016-12-10  Tuggeranong      9.5     25.0       0.0          NaN   \n","110   2010-04-18       Albany     13.0     22.6       0.0          3.8   \n","3582  2009-11-26         Sale     13.9     29.8       0.0          5.8   \n","2162  2014-04-25      Mildura      6.0     23.5       0.0          2.8   \n","\n","      Sunshine WindGustDir  WindGustSpeed WindDir9am   ...    WindSpeed9am  \\\n","1809       NaN         ESE           26.0        NNW   ...            17.0   \n","4176       NaN         NNW           33.0         NE   ...             7.0   \n","110       10.4         NaN            NaN         NE   ...            17.0   \n","3582       5.1           S           37.0          N   ...            11.0   \n","2162       8.6         NNE           24.0          E   ...            15.0   \n","\n","      WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  \\\n","1809          15.0         57.0          NaN       1016.8       1012.2   \n","4176          17.0         59.0         31.0       1020.4       1017.5   \n","110           31.0         79.0         68.0       1020.3       1015.7   \n","3582          28.0         82.0         44.0       1012.5       1005.9   \n","2162          15.0         58.0         35.0       1019.8       1014.1   \n","\n","      Cloud9am  Cloud3pm  Temp9am  Temp3pm  \n","1809       0.0       NaN     27.5      NaN  \n","4176       NaN       NaN     14.6     23.6  \n","110        1.0       3.0     17.5     20.8  \n","3582       6.0       6.0     18.5     27.5  \n","2162       2.0       4.0     12.4     22.4  \n","\n","[5 rows x 21 columns]"]},"metadata":{"tags":[]},"execution_count":11}]},{"metadata":{"id":"dtcw0Ps8JGvf","colab_type":"code","colab":{}},"cell_type":"code","source":["#恢复索引\n","for i in [Xtrain, Xtest, Ytrain, Ytest]:\n","    i.index = range(i.shape[0])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"tIp04WuLJGvm","colab_type":"code","outputId":"44a296b1-ad78-4eb5-c396-2e6a3b70976b","executionInfo":{"status":"ok","timestamp":1546770815653,"user_tz":-480,"elapsed":620,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":13,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed9am</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2016-12-10</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>7.0</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-04-18</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2009-11-26</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2014-04-25</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 21 columns</p>\n","</div>"],"text/plain":["         Date     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0  2015-08-24    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1  2016-12-10  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2  2010-04-18       Albany     13.0     22.6       0.0          3.8      10.4   \n","3  2009-11-26         Sale     13.9     29.8       0.0          5.8       5.1   \n","4  2014-04-25      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am   ...    WindSpeed9am  WindSpeed3pm  \\\n","0         ESE           26.0        NNW   ...            17.0          15.0   \n","1         NNW           33.0         NE   ...             7.0          17.0   \n","2         NaN            NaN         NE   ...            17.0          31.0   \n","3           S           37.0          N   ...            11.0          28.0   \n","4         NNE           24.0          E   ...            15.0          15.0   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0         57.0          NaN       1016.8       1012.2       0.0       NaN   \n","1         59.0         31.0       1020.4       1017.5       NaN       NaN   \n","2         79.0         68.0       1020.3       1015.7       1.0       3.0   \n","3         82.0         44.0       1012.5       1005.9       6.0       6.0   \n","4         58.0         35.0       1019.8       1014.1       2.0       4.0   \n","\n","   Temp9am  Temp3pm  \n","0     27.5      NaN  \n","1     14.6     23.6  \n","2     17.5     20.8  \n","3     18.5     27.5  \n","4     12.4     22.4  \n","\n","[5 rows x 21 columns]"]},"metadata":{"tags":[]},"execution_count":13}]},{"metadata":{"id":"o9huG5-AJGvw","colab_type":"code","outputId":"79b97c93-e4d3-4ed0-83c7-c396871c6271","executionInfo":{"status":"ok","timestamp":1546770818344,"user_tz":-480,"elapsed":972,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":119}},"cell_type":"code","source":["Ytrain.head()"],"execution_count":14,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0     No\n","1     No\n","2     No\n","3    Yes\n","4     No\n","Name: RainTomorrow, dtype: object"]},"metadata":{"tags":[]},"execution_count":14}]},{"metadata":{"id":"_GAQUGPZJGvz","colab_type":"code","outputId":"04d51925-1d2b-46cb-e8c3-6955f573a2ab","executionInfo":{"status":"ok","timestamp":1546770820253,"user_tz":-480,"elapsed":676,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":68}},"cell_type":"code","source":["#是否有样本不平衡问题？\n","Ytrain.value_counts()"],"execution_count":15,"outputs":[{"output_type":"execute_result","data":{"text/plain":["No     2704\n","Yes     796\n","Name: RainTomorrow, dtype: int64"]},"metadata":{"tags":[]},"execution_count":15}]},{"metadata":{"id":"z4EkFK6jJGv4","colab_type":"code","outputId":"3e5a340f-6af5-4f11-976b-6910848eb957","executionInfo":{"status":"ok","timestamp":1546770822282,"user_tz":-480,"elapsed":714,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":68}},"cell_type":"code","source":["Ytest.value_counts()"],"execution_count":16,"outputs":[{"output_type":"execute_result","data":{"text/plain":["No     1157\n","Yes     343\n","Name: RainTomorrow, dtype: int64"]},"metadata":{"tags":[]},"execution_count":16}]},{"metadata":{"id":"k_nd-232JGv7","colab_type":"code","colab":{}},"cell_type":"code","source":["#有轻微的样本不均衡问题"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Mkt1ckm6JGv9","colab_type":"code","outputId":"3cc11164-3109-402a-8a19-7f1c1a7f92bf","executionInfo":{"status":"ok","timestamp":1546770824598,"user_tz":-480,"elapsed":846,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Ytrain.value_counts()[0]/Ytrain.value_counts()[1]"],"execution_count":17,"outputs":[{"output_type":"execute_result","data":{"text/plain":["3.3969849246231156"]},"metadata":{"tags":[]},"execution_count":17}]},{"metadata":{"id":"gWzzfvCoJGwA","colab_type":"code","colab":{}},"cell_type":"code","source":["#将标签编码\n","from sklearn.preprocessing import LabelEncoder #标签专用，第三章讲过\n","encorder = LabelEncoder().fit(Ytrain) #允许一维数据的输入的\n","#认得了：有两类，YES和NO，YES是1，NO是0"],"execution_count":0,"outputs":[]},{"metadata":{"id":"xpYcMZcE-Qz_","colab_type":"text"},"cell_type":"markdown","source":["### 转换成dataframe后的标签为二维数据"]},{"metadata":{"id":"p4TOwn2WJGwD","colab_type":"code","colab":{}},"cell_type":"code","source":["#使用训练集进行训练，然后在训练集和测试集上分别进行transform\n","Ytrain = pd.DataFrame(encorder.transform(Ytrain))\n","Ytest = pd.DataFrame(encorder.transform(Ytest))\n","# 后面需要进行降维\n","\n","#如果我们的测试集中，出现了训练集中没有出现过的标签类别\n","#比如说，测试集中有YES, NO, UNKNOWN\n","#而我们的训练集中只有YES和NO"],"execution_count":0,"outputs":[]},{"metadata":{"id":"nG--XI7sJGwE","colab_type":"code","outputId":"155503c5-c14a-4563-fbe3-f7e8b47a1803","executionInfo":{"status":"ok","timestamp":1546770830697,"user_tz":-480,"elapsed":786,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":204}},"cell_type":"code","source":["Ytrain.head()"],"execution_count":20,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>1</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   0\n","0  0\n","1  0\n","2  0\n","3  1\n","4  0"]},"metadata":{"tags":[]},"execution_count":20}]},{"metadata":{"id":"SODKCU3YJGwJ","colab_type":"code","outputId":"2af24e05-bc75-4ec2-d1d1-3a423fbe3353","executionInfo":{"status":"ok","timestamp":1546770832422,"user_tz":-480,"elapsed":731,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":204}},"cell_type":"code","source":["Ytest.head()"],"execution_count":21,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>1</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   0\n","0  0\n","1  0\n","2  1\n","3  0\n","4  0"]},"metadata":{"tags":[]},"execution_count":21}]},{"metadata":{"id":"aUrKC6cKJGwP","colab_type":"code","colab":{}},"cell_type":"code","source":["Ytrain.to_csv(\"你想要保存这个文件的地址.文件名.csv\")"],"execution_count":0,"outputs":[]},{"metadata":{"id":"wzR8yyRwQDtn","colab_type":"text"},"cell_type":"markdown","source":["# 处理特征"]},{"metadata":{"id":"Zn7jIU5zRc-o","colab_type":"text"},"cell_type":"markdown","source":["## 1 描述性统计与异常值"]},{"metadata":{"id":"NDGtymU7JGwQ","colab_type":"code","outputId":"db366e86-fa55-404c-c779-fbef465c0311","executionInfo":{"status":"ok","timestamp":1546770835753,"user_tz":-480,"elapsed":905,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":565}},"cell_type":"code","source":["#描述性统计\n","Xtrain.describe([0.01,0.05,0.1,0.25,0.5,0.75,0.9,0.99]).T"],"execution_count":22,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>count</th>\n","      <th>mean</th>\n","      <th>std</th>\n","      <th>min</th>\n","      <th>1%</th>\n","      <th>5%</th>\n","      <th>10%</th>\n","      <th>25%</th>\n","      <th>50%</th>\n","      <th>75%</th>\n","      <th>90%</th>\n","      <th>99%</th>\n","      <th>max</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>MinTemp</th>\n","      <td>3486.0</td>\n","      <td>12.225645</td>\n","      <td>6.396243</td>\n","      <td>-6.5</td>\n","      <td>-1.715</td>\n","      <td>1.800</td>\n","      <td>4.1</td>\n","      <td>7.7</td>\n","      <td>12.0</td>\n","      <td>16.7</td>\n","      <td>20.9</td>\n","      <td>25.900</td>\n","      <td>29.0</td>\n","    </tr>\n","    <tr>\n","      <th>MaxTemp</th>\n","      <td>3489.0</td>\n","      <td>23.245543</td>\n","      <td>7.201839</td>\n","      <td>-3.7</td>\n","      <td>8.888</td>\n","      <td>12.840</td>\n","      <td>14.5</td>\n","      <td>18.0</td>\n","      <td>22.5</td>\n","      <td>28.4</td>\n","      <td>33.0</td>\n","      <td>40.400</td>\n","      <td>46.4</td>\n","    </tr>\n","    <tr>\n","      <th>Rainfall</th>\n","      <td>3467.0</td>\n","      <td>2.487049</td>\n","      <td>7.949686</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>0.8</td>\n","      <td>6.6</td>\n","      <td>41.272</td>\n","      <td>115.8</td>\n","    </tr>\n","    <tr>\n","      <th>Evaporation</th>\n","      <td>1983.0</td>\n","      <td>5.619163</td>\n","      <td>4.383098</td>\n","      <td>0.0</td>\n","      <td>0.400</td>\n","      <td>0.800</td>\n","      <td>1.4</td>\n","      <td>2.6</td>\n","      <td>4.8</td>\n","      <td>7.4</td>\n","      <td>10.2</td>\n","      <td>20.600</td>\n","      <td>56.0</td>\n","    </tr>\n","    <tr>\n","      <th>Sunshine</th>\n","      <td>1790.0</td>\n","      <td>7.508659</td>\n","      <td>3.805841</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.345</td>\n","      <td>1.4</td>\n","      <td>4.6</td>\n","      <td>8.3</td>\n","      <td>10.6</td>\n","      <td>12.0</td>\n","      <td>13.300</td>\n","      <td>13.9</td>\n","    </tr>\n","    <tr>\n","      <th>WindGustSpeed</th>\n","      <td>3263.0</td>\n","      <td>39.858413</td>\n","      <td>13.219607</td>\n","      <td>9.0</td>\n","      <td>15.000</td>\n","      <td>20.000</td>\n","      <td>24.0</td>\n","      <td>31.0</td>\n","      <td>39.0</td>\n","      <td>48.0</td>\n","      <td>57.0</td>\n","      <td>76.000</td>\n","      <td>117.0</td>\n","    </tr>\n","    <tr>\n","      <th>WindSpeed9am</th>\n","      <td>3466.0</td>\n","      <td>14.046163</td>\n","      <td>8.670472</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>4.0</td>\n","      <td>7.0</td>\n","      <td>13.0</td>\n","      <td>19.0</td>\n","      <td>26.0</td>\n","      <td>37.000</td>\n","      <td>65.0</td>\n","    </tr>\n","    <tr>\n","      <th>WindSpeed3pm</th>\n","      <td>3437.0</td>\n","      <td>18.553390</td>\n","      <td>8.611818</td>\n","      <td>0.0</td>\n","      <td>2.000</td>\n","      <td>6.000</td>\n","      <td>7.0</td>\n","      <td>13.0</td>\n","      <td>19.0</td>\n","      <td>24.0</td>\n","      <td>30.0</td>\n","      <td>43.000</td>\n","      <td>65.0</td>\n","    </tr>\n","    <tr>\n","      <th>Humidity9am</th>\n","      <td>3459.0</td>\n","      <td>69.069095</td>\n","      <td>18.787698</td>\n","      <td>2.0</td>\n","      <td>18.000</td>\n","      <td>35.000</td>\n","      <td>45.0</td>\n","      <td>57.0</td>\n","      <td>70.0</td>\n","      <td>83.0</td>\n","      <td>94.0</td>\n","      <td>100.000</td>\n","      <td>100.0</td>\n","    </tr>\n","    <tr>\n","      <th>Humidity3pm</th>\n","      <td>3408.0</td>\n","      <td>51.651995</td>\n","      <td>20.697872</td>\n","      <td>2.0</td>\n","      <td>9.000</td>\n","      <td>17.000</td>\n","      <td>23.0</td>\n","      <td>37.0</td>\n","      <td>52.0</td>\n","      <td>66.0</td>\n","      <td>79.0</td>\n","      <td>98.000</td>\n","      <td>100.0</td>\n","    </tr>\n","    <tr>\n","      <th>Pressure9am</th>\n","      <td>3154.0</td>\n","      <td>1017.622067</td>\n","      <td>7.065236</td>\n","      <td>985.1</td>\n","      <td>1000.506</td>\n","      <td>1006.100</td>\n","      <td>1008.9</td>\n","      <td>1012.8</td>\n","      <td>1017.6</td>\n","      <td>1022.3</td>\n","      <td>1027.0</td>\n","      <td>1033.247</td>\n","      <td>1038.1</td>\n","    </tr>\n","    <tr>\n","      <th>Pressure3pm</th>\n","      <td>3154.0</td>\n","      <td>1015.227077</td>\n","      <td>7.032531</td>\n","      <td>980.2</td>\n","      <td>998.000</td>\n","      <td>1004.000</td>\n","      <td>1006.5</td>\n","      <td>1010.3</td>\n","      <td>1015.2</td>\n","      <td>1020.0</td>\n","      <td>1024.4</td>\n","      <td>1030.800</td>\n","      <td>1036.0</td>\n","    </tr>\n","    <tr>\n","      <th>Cloud9am</th>\n","      <td>2171.0</td>\n","      <td>4.491939</td>\n","      <td>2.858781</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>1.0</td>\n","      <td>1.0</td>\n","      <td>5.0</td>\n","      <td>7.0</td>\n","      <td>8.0</td>\n","      <td>8.000</td>\n","      <td>8.0</td>\n","    </tr>\n","    <tr>\n","      <th>Cloud3pm</th>\n","      <td>2095.0</td>\n","      <td>4.603819</td>\n","      <td>2.655765</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>1.0</td>\n","      <td>2.0</td>\n","      <td>5.0</td>\n","      <td>7.0</td>\n","      <td>8.0</td>\n","      <td>8.000</td>\n","      <td>8.0</td>\n","    </tr>\n","    <tr>\n","      <th>Temp9am</th>\n","      <td>3481.0</td>\n","      <td>16.989859</td>\n","      <td>6.537552</td>\n","      <td>-5.2</td>\n","      <td>2.400</td>\n","      <td>7.000</td>\n","      <td>9.0</td>\n","      <td>12.2</td>\n","      <td>16.6</td>\n","      <td>21.6</td>\n","      <td>26.0</td>\n","      <td>31.000</td>\n","      <td>38.0</td>\n","    </tr>\n","    <tr>\n","      <th>Temp3pm</th>\n","      <td>3431.0</td>\n","      <td>21.719003</td>\n","      <td>7.031199</td>\n","      <td>-4.1</td>\n","      <td>7.460</td>\n","      <td>11.500</td>\n","      <td>13.3</td>\n","      <td>16.6</td>\n","      <td>21.0</td>\n","      <td>26.6</td>\n","      <td>31.4</td>\n","      <td>38.600</td>\n","      <td>45.9</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["                count         mean        std    min        1%        5%  \\\n","MinTemp        3486.0    12.225645   6.396243   -6.5    -1.715     1.800   \n","MaxTemp        3489.0    23.245543   7.201839   -3.7     8.888    12.840   \n","Rainfall       3467.0     2.487049   7.949686    0.0     0.000     0.000   \n","Evaporation    1983.0     5.619163   4.383098    0.0     0.400     0.800   \n","Sunshine       1790.0     7.508659   3.805841    0.0     0.000     0.345   \n","WindGustSpeed  3263.0    39.858413  13.219607    9.0    15.000    20.000   \n","WindSpeed9am   3466.0    14.046163   8.670472    0.0     0.000     0.000   \n","WindSpeed3pm   3437.0    18.553390   8.611818    0.0     2.000     6.000   \n","Humidity9am    3459.0    69.069095  18.787698    2.0    18.000    35.000   \n","Humidity3pm    3408.0    51.651995  20.697872    2.0     9.000    17.000   \n","Pressure9am    3154.0  1017.622067   7.065236  985.1  1000.506  1006.100   \n","Pressure3pm    3154.0  1015.227077   7.032531  980.2   998.000  1004.000   \n","Cloud9am       2171.0     4.491939   2.858781    0.0     0.000     0.000   \n","Cloud3pm       2095.0     4.603819   2.655765    0.0     0.000     0.000   \n","Temp9am        3481.0    16.989859   6.537552   -5.2     2.400     7.000   \n","Temp3pm        3431.0    21.719003   7.031199   -4.1     7.460    11.500   \n","\n","                  10%     25%     50%     75%     90%       99%     max  \n","MinTemp           4.1     7.7    12.0    16.7    20.9    25.900    29.0  \n","MaxTemp          14.5    18.0    22.5    28.4    33.0    40.400    46.4  \n","Rainfall          0.0     0.0     0.0     0.8     6.6    41.272   115.8  \n","Evaporation       1.4     2.6     4.8     7.4    10.2    20.600    56.0  \n","Sunshine          1.4     4.6     8.3    10.6    12.0    13.300    13.9  \n","WindGustSpeed    24.0    31.0    39.0    48.0    57.0    76.000   117.0  \n","WindSpeed9am      4.0     7.0    13.0    19.0    26.0    37.000    65.0  \n","WindSpeed3pm      7.0    13.0    19.0    24.0    30.0    43.000    65.0  \n","Humidity9am      45.0    57.0    70.0    83.0    94.0   100.000   100.0  \n","Humidity3pm      23.0    37.0    52.0    66.0    79.0    98.000   100.0  \n","Pressure9am    1008.9  1012.8  1017.6  1022.3  1027.0  1033.247  1038.1  \n","Pressure3pm    1006.5  1010.3  1015.2  1020.0  1024.4  1030.800  1036.0  \n","Cloud9am          1.0     1.0     5.0     7.0     8.0     8.000     8.0  \n","Cloud3pm          1.0     2.0     5.0     7.0     8.0     8.000     8.0  \n","Temp9am           9.0    12.2    16.6    21.6    26.0    31.000    38.0  \n","Temp3pm          13.3    16.6    21.0    26.6    31.4    38.600    45.9  "]},"metadata":{"tags":[]},"execution_count":22}]},{"metadata":{"id":"T8q0RKluJGwT","colab_type":"code","outputId":"caca1628-45a8-4c00-cff8-f93fbf6d97b5","executionInfo":{"status":"ok","timestamp":1546763318039,"user_tz":-480,"elapsed":1549,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":565}},"cell_type":"code","source":["Xtest.describe([0.01,0.05,0.1,0.25,0.5,0.75,0.9,0.99]).T"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>count</th>\n","      <th>mean</th>\n","      <th>std</th>\n","      <th>min</th>\n","      <th>1%</th>\n","      <th>5%</th>\n","      <th>10%</th>\n","      <th>25%</th>\n","      <th>50%</th>\n","      <th>75%</th>\n","      <th>90%</th>\n","      <th>99%</th>\n","      <th>max</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>MinTemp</th>\n","      <td>1493.0</td>\n","      <td>11.916812</td>\n","      <td>6.375377</td>\n","      <td>-8.5</td>\n","      <td>-2.024</td>\n","      <td>1.600</td>\n","      <td>3.70</td>\n","      <td>7.3</td>\n","      <td>11.8</td>\n","      <td>16.5</td>\n","      <td>20.48</td>\n","      <td>25.316</td>\n","      <td>28.3</td>\n","    </tr>\n","    <tr>\n","      <th>MaxTemp</th>\n","      <td>1498.0</td>\n","      <td>22.906809</td>\n","      <td>6.986043</td>\n","      <td>-0.8</td>\n","      <td>9.134</td>\n","      <td>13.000</td>\n","      <td>14.50</td>\n","      <td>17.8</td>\n","      <td>22.4</td>\n","      <td>27.8</td>\n","      <td>32.60</td>\n","      <td>38.303</td>\n","      <td>45.1</td>\n","    </tr>\n","    <tr>\n","      <th>Rainfall</th>\n","      <td>1483.0</td>\n","      <td>2.241807</td>\n","      <td>7.988822</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>0.00</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>0.8</td>\n","      <td>5.20</td>\n","      <td>35.372</td>\n","      <td>108.2</td>\n","    </tr>\n","    <tr>\n","      <th>Evaporation</th>\n","      <td>858.0</td>\n","      <td>5.657809</td>\n","      <td>4.105762</td>\n","      <td>0.0</td>\n","      <td>0.400</td>\n","      <td>1.000</td>\n","      <td>1.60</td>\n","      <td>2.8</td>\n","      <td>4.8</td>\n","      <td>7.6</td>\n","      <td>10.40</td>\n","      <td>19.458</td>\n","      <td>38.8</td>\n","    </tr>\n","    <tr>\n","      <th>Sunshine</th>\n","      <td>781.0</td>\n","      <td>7.677465</td>\n","      <td>3.862294</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.300</td>\n","      <td>1.50</td>\n","      <td>4.7</td>\n","      <td>8.6</td>\n","      <td>10.7</td>\n","      <td>12.20</td>\n","      <td>13.400</td>\n","      <td>13.9</td>\n","    </tr>\n","    <tr>\n","      <th>WindGustSpeed</th>\n","      <td>1406.0</td>\n","      <td>40.044097</td>\n","      <td>14.027052</td>\n","      <td>9.0</td>\n","      <td>15.000</td>\n","      <td>20.000</td>\n","      <td>24.00</td>\n","      <td>30.0</td>\n","      <td>39.0</td>\n","      <td>48.0</td>\n","      <td>57.00</td>\n","      <td>78.000</td>\n","      <td>122.0</td>\n","    </tr>\n","    <tr>\n","      <th>WindSpeed9am</th>\n","      <td>1483.0</td>\n","      <td>13.986514</td>\n","      <td>9.124337</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>4.00</td>\n","      <td>7.0</td>\n","      <td>13.0</td>\n","      <td>20.0</td>\n","      <td>26.00</td>\n","      <td>39.360</td>\n","      <td>72.0</td>\n","    </tr>\n","    <tr>\n","      <th>WindSpeed3pm</th>\n","      <td>1482.0</td>\n","      <td>18.601215</td>\n","      <td>8.850446</td>\n","      <td>0.0</td>\n","      <td>2.000</td>\n","      <td>6.000</td>\n","      <td>7.00</td>\n","      <td>13.0</td>\n","      <td>19.0</td>\n","      <td>24.0</td>\n","      <td>31.00</td>\n","      <td>43.000</td>\n","      <td>56.0</td>\n","    </tr>\n","    <tr>\n","      <th>Humidity9am</th>\n","      <td>1477.0</td>\n","      <td>68.688558</td>\n","      <td>18.876448</td>\n","      <td>4.0</td>\n","      <td>20.000</td>\n","      <td>36.000</td>\n","      <td>44.00</td>\n","      <td>57.0</td>\n","      <td>69.0</td>\n","      <td>82.0</td>\n","      <td>95.00</td>\n","      <td>100.000</td>\n","      <td>100.0</td>\n","    </tr>\n","    <tr>\n","      <th>Humidity3pm</th>\n","      <td>1472.0</td>\n","      <td>51.431386</td>\n","      <td>20.459957</td>\n","      <td>2.0</td>\n","      <td>8.710</td>\n","      <td>18.000</td>\n","      <td>23.00</td>\n","      <td>37.0</td>\n","      <td>52.0</td>\n","      <td>66.0</td>\n","      <td>78.00</td>\n","      <td>96.290</td>\n","      <td>100.0</td>\n","    </tr>\n","    <tr>\n","      <th>Pressure9am</th>\n","      <td>1352.0</td>\n","      <td>1017.763536</td>\n","      <td>6.910275</td>\n","      <td>988.5</td>\n","      <td>1000.900</td>\n","      <td>1006.255</td>\n","      <td>1008.61</td>\n","      <td>1013.2</td>\n","      <td>1017.8</td>\n","      <td>1022.3</td>\n","      <td>1026.50</td>\n","      <td>1033.449</td>\n","      <td>1038.2</td>\n","    </tr>\n","    <tr>\n","      <th>Pressure3pm</th>\n","      <td>1350.0</td>\n","      <td>1015.397926</td>\n","      <td>6.916976</td>\n","      <td>986.2</td>\n","      <td>999.198</td>\n","      <td>1003.900</td>\n","      <td>1006.49</td>\n","      <td>1010.9</td>\n","      <td>1015.4</td>\n","      <td>1020.0</td>\n","      <td>1024.20</td>\n","      <td>1031.151</td>\n","      <td>1036.9</td>\n","    </tr>\n","    <tr>\n","      <th>Cloud9am</th>\n","      <td>940.0</td>\n","      <td>4.494681</td>\n","      <td>2.870468</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>1.00</td>\n","      <td>1.0</td>\n","      <td>5.0</td>\n","      <td>7.0</td>\n","      <td>8.00</td>\n","      <td>8.000</td>\n","      <td>8.0</td>\n","    </tr>\n","    <tr>\n","      <th>Cloud3pm</th>\n","      <td>917.0</td>\n","      <td>4.403490</td>\n","      <td>2.731969</td>\n","      <td>0.0</td>\n","      <td>0.000</td>\n","      <td>0.000</td>\n","      <td>1.00</td>\n","      <td>2.0</td>\n","      <td>5.0</td>\n","      <td>7.0</td>\n","      <td>8.00</td>\n","      <td>8.000</td>\n","      <td>8.0</td>\n","    </tr>\n","    <tr>\n","      <th>Temp9am</th>\n","      <td>1486.0</td>\n","      <td>16.751817</td>\n","      <td>6.339816</td>\n","      <td>-5.3</td>\n","      <td>2.370</td>\n","      <td>6.725</td>\n","      <td>9.00</td>\n","      <td>12.1</td>\n","      <td>16.5</td>\n","      <td>21.3</td>\n","      <td>25.45</td>\n","      <td>30.200</td>\n","      <td>35.1</td>\n","    </tr>\n","    <tr>\n","      <th>Temp3pm</th>\n","      <td>1481.0</td>\n","      <td>21.483660</td>\n","      <td>6.770567</td>\n","      <td>-1.2</td>\n","      <td>8.540</td>\n","      <td>11.800</td>\n","      <td>13.30</td>\n","      <td>16.5</td>\n","      <td>20.9</td>\n","      <td>26.2</td>\n","      <td>30.90</td>\n","      <td>37.400</td>\n","      <td>42.9</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["                count         mean        std    min        1%        5%  \\\n","MinTemp        1493.0    11.916812   6.375377   -8.5    -2.024     1.600   \n","MaxTemp        1498.0    22.906809   6.986043   -0.8     9.134    13.000   \n","Rainfall       1483.0     2.241807   7.988822    0.0     0.000     0.000   \n","Evaporation     858.0     5.657809   4.105762    0.0     0.400     1.000   \n","Sunshine        781.0     7.677465   3.862294    0.0     0.000     0.300   \n","WindGustSpeed  1406.0    40.044097  14.027052    9.0    15.000    20.000   \n","WindSpeed9am   1483.0    13.986514   9.124337    0.0     0.000     0.000   \n","WindSpeed3pm   1482.0    18.601215   8.850446    0.0     2.000     6.000   \n","Humidity9am    1477.0    68.688558  18.876448    4.0    20.000    36.000   \n","Humidity3pm    1472.0    51.431386  20.459957    2.0     8.710    18.000   \n","Pressure9am    1352.0  1017.763536   6.910275  988.5  1000.900  1006.255   \n","Pressure3pm    1350.0  1015.397926   6.916976  986.2   999.198  1003.900   \n","Cloud9am        940.0     4.494681   2.870468    0.0     0.000     0.000   \n","Cloud3pm        917.0     4.403490   2.731969    0.0     0.000     0.000   \n","Temp9am        1486.0    16.751817   6.339816   -5.3     2.370     6.725   \n","Temp3pm        1481.0    21.483660   6.770567   -1.2     8.540    11.800   \n","\n","                   10%     25%     50%     75%      90%       99%     max  \n","MinTemp           3.70     7.3    11.8    16.5    20.48    25.316    28.3  \n","MaxTemp          14.50    17.8    22.4    27.8    32.60    38.303    45.1  \n","Rainfall          0.00     0.0     0.0     0.8     5.20    35.372   108.2  \n","Evaporation       1.60     2.8     4.8     7.6    10.40    19.458    38.8  \n","Sunshine          1.50     4.7     8.6    10.7    12.20    13.400    13.9  \n","WindGustSpeed    24.00    30.0    39.0    48.0    57.00    78.000   122.0  \n","WindSpeed9am      4.00     7.0    13.0    20.0    26.00    39.360    72.0  \n","WindSpeed3pm      7.00    13.0    19.0    24.0    31.00    43.000    56.0  \n","Humidity9am      44.00    57.0    69.0    82.0    95.00   100.000   100.0  \n","Humidity3pm      23.00    37.0    52.0    66.0    78.00    96.290   100.0  \n","Pressure9am    1008.61  1013.2  1017.8  1022.3  1026.50  1033.449  1038.2  \n","Pressure3pm    1006.49  1010.9  1015.4  1020.0  1024.20  1031.151  1036.9  \n","Cloud9am          1.00     1.0     5.0     7.0     8.00     8.000     8.0  \n","Cloud3pm          1.00     2.0     5.0     7.0     8.00     8.000     8.0  \n","Temp9am           9.00    12.1    16.5    21.3    25.45    30.200    35.1  \n","Temp3pm          13.30    16.5    20.9    26.2    30.90    37.400    42.9  "]},"metadata":{"tags":[]},"execution_count":26}]},{"metadata":{"id":"Hv0RUT0NJGwe","colab_type":"code","colab":{}},"cell_type":"code","source":["#对于去kaggle上下载了数据的小伙伴们，以及对于坚持要使用完整版数据的（15W行）数据的小伙伴们\n","#如果你发现了异常值，首先你要观察，这个异常值出现的频率\n","#如果异常值只出现了一次，多半是输入错误，直接把异常值删除\n","#如果异常值出现了多次，去跟业务人员沟通，人为造成的错误异常值留着是没有用的\n","#如果异常值占到你总数据量的10%左右了 - 把异常值替换成非异常但是非干扰的项，比如说用0来进行替换，或者把异常当缺失"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Ai-ChUTyJGwg","colab_type":"code","outputId":"f8e0bb4b-93d3-4df0-e21f-cf46c19541bd","executionInfo":{"status":"ok","timestamp":1546763324928,"user_tz":-480,"elapsed":946,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed9am</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2016-12-10</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>7.0</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-04-18</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2009-11-26</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2014-04-25</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 21 columns</p>\n","</div>"],"text/plain":["         Date     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0  2015-08-24    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1  2016-12-10  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2  2010-04-18       Albany     13.0     22.6       0.0          3.8      10.4   \n","3  2009-11-26         Sale     13.9     29.8       0.0          5.8       5.1   \n","4  2014-04-25      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am   ...    WindSpeed9am  WindSpeed3pm  \\\n","0         ESE           26.0        NNW   ...            17.0          15.0   \n","1         NNW           33.0         NE   ...             7.0          17.0   \n","2         NaN            NaN         NE   ...            17.0          31.0   \n","3           S           37.0          N   ...            11.0          28.0   \n","4         NNE           24.0          E   ...            15.0          15.0   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0         57.0          NaN       1016.8       1012.2       0.0       NaN   \n","1         59.0         31.0       1020.4       1017.5       NaN       NaN   \n","2         79.0         68.0       1020.3       1015.7       1.0       3.0   \n","3         82.0         44.0       1012.5       1005.9       6.0       6.0   \n","4         58.0         35.0       1019.8       1014.1       2.0       4.0   \n","\n","   Temp9am  Temp3pm  \n","0     27.5      NaN  \n","1     14.6     23.6  \n","2     17.5     20.8  \n","3     18.5     27.5  \n","4     12.4     22.4  \n","\n","[5 rows x 21 columns]"]},"metadata":{"tags":[]},"execution_count":27}]},{"metadata":{"id":"neOw3L7ESyoO","colab_type":"text"},"cell_type":"markdown","source":["## 2 处理困难特征：日期"]},{"metadata":{"id":"nExwVruSJGwm","colab_type":"code","outputId":"fc909d86-35e4-400c-849b-75fd397f97a9","executionInfo":{"status":"ok","timestamp":1546770842091,"user_tz":-480,"elapsed":829,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["type(Xtrain.iloc[0,0]) #字符串"],"execution_count":23,"outputs":[{"output_type":"execute_result","data":{"text/plain":["str"]},"metadata":{"tags":[]},"execution_count":23}]},{"metadata":{"id":"MixTock-JGw5","colab_type":"code","colab":{}},"cell_type":"code","source":["#我们现在拥有的日期特征，是连续型特征，还是分类型特征\n","#2019-1-6\n","#2019-1-6.5\n","#日期是一年分了365类的分类型变量\n","#我们的日期特征中，日期是否有重复"],"execution_count":0,"outputs":[]},{"metadata":{"id":"QKScUaIDJGw9","colab_type":"code","outputId":"ac0c1a5b-482f-4d82-b701-3bc88cef2e4c","executionInfo":{"status":"ok","timestamp":1546770844082,"user_tz":-480,"elapsed":823,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":1071}},"cell_type":"code","source":["Xtrain.iloc[:,0].value_counts()"],"execution_count":24,"outputs":[{"output_type":"execute_result","data":{"text/plain":["2015-07-03    6\n","2015-10-12    6\n","2014-05-16    6\n","2009-07-17    5\n","2011-09-04    5\n","2014-06-16    5\n","2012-07-18    5\n","2014-07-26    5\n","2010-11-03    5\n","2012-09-18    5\n","2011-11-04    5\n","2014-02-12    5\n","2014-03-12    5\n","2011-07-19    5\n","2009-06-29    5\n","2012-11-23    5\n","2009-03-30    5\n","2010-05-18    5\n","2016-09-07    5\n","2017-01-09    5\n","2013-12-20    5\n","2016-11-01    5\n","2016-11-25    4\n","2010-12-11    4\n","2015-10-04    4\n","2011-02-05    4\n","2015-11-15    4\n","2010-10-31    4\n","2015-03-16    4\n","2014-08-17    4\n","             ..\n","2015-05-29    1\n","2013-07-29    1\n","2015-07-30    1\n","2009-08-11    1\n","2014-06-30    1\n","2016-02-26    1\n","2012-05-21    1\n","2014-07-31    1\n","2016-04-04    1\n","2010-09-11    1\n","2013-12-22    1\n","2010-01-15    1\n","2015-11-13    1\n","2015-11-05    1\n","2012-10-13    1\n","2009-03-15    1\n","2017-01-04    1\n","2014-07-21    1\n","2010-09-07    1\n","2008-07-25    1\n","2014-06-27    1\n","2017-04-28    1\n","2010-06-07    1\n","2011-12-25    1\n","2015-08-14    1\n","2011-02-23    1\n","2017-04-11    1\n","2010-11-02    1\n","2014-08-07    1\n","2009-10-20    1\n","Name: Date, Length: 2141, dtype: int64"]},"metadata":{"tags":[]},"execution_count":24}]},{"metadata":{"id":"Frmlq99WJGwu","colab_type":"code","colab":{}},"cell_type":"code","source":["Xtrainc = Xtrain.copy()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"isbtbXzeJGwy","colab_type":"code","outputId":"8016f3e7-42fb-4d13-9a38-a348bc22a254","executionInfo":{"status":"ok","timestamp":1546764334031,"user_tz":-480,"elapsed":748,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":3009}},"cell_type":"code","source":["Xtrainc.sort_values(by=\"Location\")"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed9am</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>2796</th>\n","      <td>2015-03-24</td>\n","      <td>Adelaide</td>\n","      <td>12.3</td>\n","      <td>19.3</td>\n","      <td>0.0</td>\n","      <td>5.0</td>\n","      <td>NaN</td>\n","      <td>S</td>\n","      <td>39.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>19.0</td>\n","      <td>59.0</td>\n","      <td>47.0</td>\n","      <td>1022.2</td>\n","      <td>1021.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>15.1</td>\n","      <td>17.7</td>\n","    </tr>\n","    <tr>\n","      <th>2975</th>\n","      <td>2012-08-17</td>\n","      <td>Adelaide</td>\n","      <td>7.8</td>\n","      <td>13.2</td>\n","      <td>17.6</td>\n","      <td>0.8</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>61.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>28.0</td>\n","      <td>76.0</td>\n","      <td>47.0</td>\n","      <td>1012.5</td>\n","      <td>1014.7</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>8.3</td>\n","      <td>12.5</td>\n","    </tr>\n","    <tr>\n","      <th>775</th>\n","      <td>2013-03-16</td>\n","      <td>Adelaide</td>\n","      <td>17.4</td>\n","      <td>23.8</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>9.7</td>\n","      <td>SSE</td>\n","      <td>46.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>19.0</td>\n","      <td>63.0</td>\n","      <td>57.0</td>\n","      <td>1019.9</td>\n","      <td>1020.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>19.1</td>\n","      <td>20.7</td>\n","    </tr>\n","    <tr>\n","      <th>861</th>\n","      <td>2011-07-12</td>\n","      <td>Adelaide</td>\n","      <td>7.9</td>\n","      <td>11.4</td>\n","      <td>0.0</td>\n","      <td>1.0</td>\n","      <td>0.5</td>\n","      <td>N</td>\n","      <td>20.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>70.0</td>\n","      <td>59.0</td>\n","      <td>1028.7</td>\n","      <td>1025.7</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>8.4</td>\n","      <td>11.3</td>\n","    </tr>\n","    <tr>\n","      <th>2906</th>\n","      <td>2015-08-24</td>\n","      <td>Adelaide</td>\n","      <td>9.2</td>\n","      <td>14.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>48.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>19.0</td>\n","      <td>64.0</td>\n","      <td>42.0</td>\n","      <td>1024.7</td>\n","      <td>1024.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>9.9</td>\n","      <td>13.4</td>\n","    </tr>\n","    <tr>\n","      <th>2900</th>\n","      <td>2009-09-17</td>\n","      <td>Adelaide</td>\n","      <td>14.2</td>\n","      <td>17.4</td>\n","      <td>8.8</td>\n","      <td>2.0</td>\n","      <td>7.1</td>\n","      <td>SW</td>\n","      <td>41.0</td>\n","      <td>SSW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>20.0</td>\n","      <td>82.0</td>\n","      <td>56.0</td>\n","      <td>1014.9</td>\n","      <td>1018.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>16.2</td>\n","      <td>16.7</td>\n","    </tr>\n","    <tr>\n","      <th>902</th>\n","      <td>2008-12-10</td>\n","      <td>Adelaide</td>\n","      <td>14.2</td>\n","      <td>28.0</td>\n","      <td>0.0</td>\n","      <td>6.4</td>\n","      <td>12.5</td>\n","      <td>SE</td>\n","      <td>48.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>13.0</td>\n","      <td>56.0</td>\n","      <td>35.0</td>\n","      <td>1010.8</td>\n","      <td>1008.9</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>19.3</td>\n","      <td>25.6</td>\n","    </tr>\n","    <tr>\n","      <th>919</th>\n","      <td>2011-10-12</td>\n","      <td>Adelaide</td>\n","      <td>7.7</td>\n","      <td>19.9</td>\n","      <td>0.0</td>\n","      <td>3.4</td>\n","      <td>11.4</td>\n","      <td>W</td>\n","      <td>30.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>15.0</td>\n","      <td>56.0</td>\n","      <td>43.0</td>\n","      <td>1021.2</td>\n","      <td>1018.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.1</td>\n","      <td>19.4</td>\n","    </tr>\n","    <tr>\n","      <th>936</th>\n","      <td>2014-03-11</td>\n","      <td>Adelaide</td>\n","      <td>22.3</td>\n","      <td>32.2</td>\n","      <td>0.4</td>\n","      <td>20.6</td>\n","      <td>3.2</td>\n","      <td>W</td>\n","      <td>65.0</td>\n","      <td>ESE</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>9.0</td>\n","      <td>53.0</td>\n","      <td>78.0</td>\n","      <td>1017.0</td>\n","      <td>1017.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>25.6</td>\n","      <td>22.8</td>\n","    </tr>\n","    <tr>\n","      <th>942</th>\n","      <td>2015-02-23</td>\n","      <td>Adelaide</td>\n","      <td>20.6</td>\n","      <td>26.5</td>\n","      <td>0.0</td>\n","      <td>16.2</td>\n","      <td>NaN</td>\n","      <td>SSE</td>\n","      <td>48.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>22.0</td>\n","      <td>61.0</td>\n","      <td>43.0</td>\n","      <td>1015.3</td>\n","      <td>1016.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>22.2</td>\n","      <td>25.7</td>\n","    </tr>\n","    <tr>\n","      <th>999</th>\n","      <td>2009-11-30</td>\n","      <td>Adelaide</td>\n","      <td>13.1</td>\n","      <td>22.4</td>\n","      <td>0.6</td>\n","      <td>13.6</td>\n","      <td>10.4</td>\n","      <td>SSE</td>\n","      <td>37.0</td>\n","      <td>SSE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>66.0</td>\n","      <td>43.0</td>\n","      <td>1017.9</td>\n","      <td>1016.8</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>16.1</td>\n","      <td>20.9</td>\n","    </tr>\n","    <tr>\n","      <th>1013</th>\n","      <td>2012-08-23</td>\n","      <td>Adelaide</td>\n","      <td>8.1</td>\n","      <td>12.4</td>\n","      <td>6.0</td>\n","      <td>1.8</td>\n","      <td>NaN</td>\n","      <td>WNW</td>\n","      <td>74.0</td>\n","      <td>NW</td>\n","      <td>...</td>\n","      <td>26.0</td>\n","      <td>37.0</td>\n","      <td>74.0</td>\n","      <td>78.0</td>\n","      <td>1002.6</td>\n","      <td>1005.6</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>10.7</td>\n","      <td>7.4</td>\n","    </tr>\n","    <tr>\n","      <th>1042</th>\n","      <td>2008-11-03</td>\n","      <td>Adelaide</td>\n","      <td>13.3</td>\n","      <td>21.2</td>\n","      <td>0.0</td>\n","      <td>15.2</td>\n","      <td>10.0</td>\n","      <td>SSE</td>\n","      <td>39.0</td>\n","      <td>SSW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>20.0</td>\n","      <td>50.0</td>\n","      <td>39.0</td>\n","      <td>1021.9</td>\n","      <td>1020.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.8</td>\n","      <td>19.9</td>\n","    </tr>\n","    <tr>\n","      <th>701</th>\n","      <td>2009-01-08</td>\n","      <td>Adelaide</td>\n","      <td>14.3</td>\n","      <td>23.8</td>\n","      <td>0.0</td>\n","      <td>7.4</td>\n","      <td>12.7</td>\n","      <td>SE</td>\n","      <td>37.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>22.0</td>\n","      <td>45.0</td>\n","      <td>30.0</td>\n","      <td>1019.9</td>\n","      <td>1019.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>17.6</td>\n","      <td>23.2</td>\n","    </tr>\n","    <tr>\n","      <th>109</th>\n","      <td>2012-05-02</td>\n","      <td>Adelaide</td>\n","      <td>9.4</td>\n","      <td>16.5</td>\n","      <td>12.4</td>\n","      <td>0.8</td>\n","      <td>NaN</td>\n","      <td>SSE</td>\n","      <td>39.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>15.0</td>\n","      <td>53.0</td>\n","      <td>47.0</td>\n","      <td>1029.6</td>\n","      <td>1028.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>13.5</td>\n","      <td>14.6</td>\n","    </tr>\n","    <tr>\n","      <th>227</th>\n","      <td>2016-08-31</td>\n","      <td>Adelaide</td>\n","      <td>11.9</td>\n","      <td>16.8</td>\n","      <td>1.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>28.0</td>\n","      <td>WNW</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>13.0</td>\n","      <td>80.0</td>\n","      <td>79.0</td>\n","      <td>1018.5</td>\n","      <td>1017.7</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.3</td>\n","      <td>15.2</td>\n","    </tr>\n","    <tr>\n","      <th>1190</th>\n","      <td>2015-07-01</td>\n","      <td>Adelaide</td>\n","      <td>4.7</td>\n","      <td>14.5</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>WSW</td>\n","      <td>20.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>6.0</td>\n","      <td>13.0</td>\n","      <td>78.0</td>\n","      <td>48.0</td>\n","      <td>1030.6</td>\n","      <td>1027.6</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>8.8</td>\n","      <td>13.1</td>\n","    </tr>\n","    <tr>\n","      <th>2701</th>\n","      <td>2013-05-16</td>\n","      <td>Adelaide</td>\n","      <td>10.7</td>\n","      <td>17.5</td>\n","      <td>7.0</td>\n","      <td>1.4</td>\n","      <td>7.1</td>\n","      <td>SW</td>\n","      <td>35.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>6.0</td>\n","      <td>19.0</td>\n","      <td>88.0</td>\n","      <td>54.0</td>\n","      <td>1016.3</td>\n","      <td>1015.9</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>13.1</td>\n","      <td>16.9</td>\n","    </tr>\n","    <tr>\n","      <th>1227</th>\n","      <td>2016-06-22</td>\n","      <td>Adelaide</td>\n","      <td>10.2</td>\n","      <td>16.5</td>\n","      <td>11.8</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>WNW</td>\n","      <td>39.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>17.0</td>\n","      <td>67.0</td>\n","      <td>63.0</td>\n","      <td>1010.3</td>\n","      <td>1010.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>13.5</td>\n","      <td>15.5</td>\n","    </tr>\n","    <tr>\n","      <th>1234</th>\n","      <td>2017-01-09</td>\n","      <td>Adelaide</td>\n","      <td>20.2</td>\n","      <td>30.4</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>24.0</td>\n","      <td>ESE</td>\n","      <td>...</td>\n","      <td>6.0</td>\n","      <td>9.0</td>\n","      <td>70.0</td>\n","      <td>38.0</td>\n","      <td>1012.7</td>\n","      <td>1011.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>20.9</td>\n","      <td>28.9</td>\n","    </tr>\n","    <tr>\n","      <th>1266</th>\n","      <td>2008-11-07</td>\n","      <td>Adelaide</td>\n","      <td>18.3</td>\n","      <td>22.5</td>\n","      <td>0.2</td>\n","      <td>8.0</td>\n","      <td>1.4</td>\n","      <td>WNW</td>\n","      <td>56.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>28.0</td>\n","      <td>58.0</td>\n","      <td>51.0</td>\n","      <td>1001.0</td>\n","      <td>1004.7</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>22.4</td>\n","      <td>18.4</td>\n","    </tr>\n","    <tr>\n","      <th>1282</th>\n","      <td>2012-09-03</td>\n","      <td>Adelaide</td>\n","      <td>7.7</td>\n","      <td>22.9</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>56.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>17.0</td>\n","      <td>27.0</td>\n","      <td>22.0</td>\n","      <td>1021.1</td>\n","      <td>1018.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>17.5</td>\n","      <td>22.1</td>\n","    </tr>\n","    <tr>\n","      <th>1289</th>\n","      <td>2010-03-09</td>\n","      <td>Adelaide</td>\n","      <td>14.3</td>\n","      <td>22.0</td>\n","      <td>1.6</td>\n","      <td>16.4</td>\n","      <td>7.8</td>\n","      <td>SW</td>\n","      <td>39.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>20.0</td>\n","      <td>75.0</td>\n","      <td>36.0</td>\n","      <td>1021.2</td>\n","      <td>1022.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>16.8</td>\n","      <td>21.6</td>\n","    </tr>\n","    <tr>\n","      <th>86</th>\n","      <td>2010-11-08</td>\n","      <td>Adelaide</td>\n","      <td>13.7</td>\n","      <td>23.1</td>\n","      <td>0.0</td>\n","      <td>16.0</td>\n","      <td>12.2</td>\n","      <td>W</td>\n","      <td>31.0</td>\n","      <td>WNW</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>17.0</td>\n","      <td>61.0</td>\n","      <td>38.0</td>\n","      <td>1016.0</td>\n","      <td>1016.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>17.2</td>\n","      <td>22.5</td>\n","    </tr>\n","    <tr>\n","      <th>83</th>\n","      <td>2012-10-08</td>\n","      <td>Adelaide</td>\n","      <td>10.2</td>\n","      <td>23.6</td>\n","      <td>0.2</td>\n","      <td>10.0</td>\n","      <td>NaN</td>\n","      <td>E</td>\n","      <td>33.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>17.0</td>\n","      <td>46.0</td>\n","      <td>28.0</td>\n","      <td>1016.7</td>\n","      <td>1012.9</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>15.1</td>\n","      <td>22.6</td>\n","    </tr>\n","    <tr>\n","      <th>1356</th>\n","      <td>2014-03-05</td>\n","      <td>Adelaide</td>\n","      <td>16.7</td>\n","      <td>24.8</td>\n","      <td>0.0</td>\n","      <td>6.6</td>\n","      <td>11.7</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>24.0</td>\n","      <td>61.0</td>\n","      <td>48.0</td>\n","      <td>1019.3</td>\n","      <td>1018.9</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>20.8</td>\n","      <td>23.7</td>\n","    </tr>\n","    <tr>\n","      <th>1390</th>\n","      <td>2015-10-04</td>\n","      <td>Adelaide</td>\n","      <td>15.4</td>\n","      <td>29.7</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>WNW</td>\n","      <td>20.0</td>\n","      <td>NaN</td>\n","      <td>...</td>\n","      <td>0.0</td>\n","      <td>9.0</td>\n","      <td>44.0</td>\n","      <td>22.0</td>\n","      <td>1024.0</td>\n","      <td>1022.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>18.3</td>\n","      <td>27.4</td>\n","    </tr>\n","    <tr>\n","      <th>107</th>\n","      <td>2015-10-01</td>\n","      <td>Adelaide</td>\n","      <td>7.8</td>\n","      <td>24.4</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>WSW</td>\n","      <td>22.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>15.0</td>\n","      <td>35.0</td>\n","      <td>23.0</td>\n","      <td>1028.4</td>\n","      <td>1028.6</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>19.1</td>\n","      <td>23.8</td>\n","    </tr>\n","    <tr>\n","      <th>3403</th>\n","      <td>2015-12-05</td>\n","      <td>Adelaide</td>\n","      <td>20.7</td>\n","      <td>40.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>31.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>13.0</td>\n","      <td>18.0</td>\n","      <td>13.0</td>\n","      <td>1015.3</td>\n","      <td>1012.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>33.4</td>\n","      <td>38.6</td>\n","    </tr>\n","    <tr>\n","      <th>3023</th>\n","      <td>2012-11-06</td>\n","      <td>Adelaide</td>\n","      <td>14.7</td>\n","      <td>22.8</td>\n","      <td>8.0</td>\n","      <td>3.2</td>\n","      <td>NaN</td>\n","      <td>NW</td>\n","      <td>31.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>64.0</td>\n","      <td>46.0</td>\n","      <td>1011.9</td>\n","      <td>1011.6</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>17.7</td>\n","      <td>21.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>179</th>\n","      <td>2015-12-20</td>\n","      <td>Woomera</td>\n","      <td>27.1</td>\n","      <td>31.3</td>\n","      <td>0.4</td>\n","      <td>18.0</td>\n","      <td>2.1</td>\n","      <td>SE</td>\n","      <td>56.0</td>\n","      <td>ENE</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>35.0</td>\n","      <td>37.0</td>\n","      <td>41.0</td>\n","      <td>1007.7</td>\n","      <td>1007.7</td>\n","      <td>1.0</td>\n","      <td>NaN</td>\n","      <td>30.4</td>\n","      <td>29.7</td>\n","    </tr>\n","    <tr>\n","      <th>212</th>\n","      <td>2009-06-25</td>\n","      <td>Woomera</td>\n","      <td>9.1</td>\n","      <td>18.4</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>4.4</td>\n","      <td>N</td>\n","      <td>41.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>20.0</td>\n","      <td>54.0</td>\n","      <td>90.0</td>\n","      <td>1012.9</td>\n","      <td>1008.8</td>\n","      <td>6.0</td>\n","      <td>8.0</td>\n","      <td>13.2</td>\n","      <td>14.2</td>\n","    </tr>\n","    <tr>\n","      <th>1392</th>\n","      <td>2015-11-06</td>\n","      <td>Woomera</td>\n","      <td>13.1</td>\n","      <td>28.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>33.0</td>\n","      <td>SSE</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>7.0</td>\n","      <td>65.0</td>\n","      <td>36.0</td>\n","      <td>1015.9</td>\n","      <td>1013.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>17.6</td>\n","      <td>26.0</td>\n","    </tr>\n","    <tr>\n","      <th>1436</th>\n","      <td>2009-10-19</td>\n","      <td>Woomera</td>\n","      <td>12.6</td>\n","      <td>30.0</td>\n","      <td>0.0</td>\n","      <td>7.8</td>\n","      <td>12.3</td>\n","      <td>N</td>\n","      <td>44.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>22.0</td>\n","      <td>20.0</td>\n","      <td>8.0</td>\n","      <td>1025.5</td>\n","      <td>1021.3</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>19.9</td>\n","      <td>28.7</td>\n","    </tr>\n","    <tr>\n","      <th>1431</th>\n","      <td>2012-01-16</td>\n","      <td>Woomera</td>\n","      <td>18.9</td>\n","      <td>38.8</td>\n","      <td>0.0</td>\n","      <td>12.0</td>\n","      <td>12.4</td>\n","      <td>N</td>\n","      <td>41.0</td>\n","      <td>ENE</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>20.0</td>\n","      <td>10.0</td>\n","      <td>5.0</td>\n","      <td>1012.0</td>\n","      <td>1008.7</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>27.6</td>\n","      <td>37.9</td>\n","    </tr>\n","    <tr>\n","      <th>204</th>\n","      <td>2014-02-05</td>\n","      <td>Woomera</td>\n","      <td>23.1</td>\n","      <td>38.6</td>\n","      <td>0.0</td>\n","      <td>19.8</td>\n","      <td>6.3</td>\n","      <td>SE</td>\n","      <td>37.0</td>\n","      <td>ESE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>6.0</td>\n","      <td>18.0</td>\n","      <td>11.0</td>\n","      <td>1012.1</td>\n","      <td>1009.9</td>\n","      <td>3.0</td>\n","      <td>2.0</td>\n","      <td>26.8</td>\n","      <td>36.2</td>\n","    </tr>\n","    <tr>\n","      <th>225</th>\n","      <td>2013-08-23</td>\n","      <td>Woomera</td>\n","      <td>6.5</td>\n","      <td>17.7</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>3.6</td>\n","      <td>SW</td>\n","      <td>43.0</td>\n","      <td>WSW</td>\n","      <td>...</td>\n","      <td>22.0</td>\n","      <td>26.0</td>\n","      <td>76.0</td>\n","      <td>46.0</td>\n","      <td>1024.2</td>\n","      <td>1022.9</td>\n","      <td>1.0</td>\n","      <td>7.0</td>\n","      <td>13.2</td>\n","      <td>17.3</td>\n","    </tr>\n","    <tr>\n","      <th>400</th>\n","      <td>2016-02-09</td>\n","      <td>Woomera</td>\n","      <td>20.2</td>\n","      <td>39.4</td>\n","      <td>0.0</td>\n","      <td>17.6</td>\n","      <td>12.8</td>\n","      <td>SSE</td>\n","      <td>43.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>9.0</td>\n","      <td>50.0</td>\n","      <td>12.0</td>\n","      <td>1016.8</td>\n","      <td>1013.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>24.0</td>\n","      <td>37.7</td>\n","    </tr>\n","    <tr>\n","      <th>1174</th>\n","      <td>2011-07-27</td>\n","      <td>Woomera</td>\n","      <td>4.9</td>\n","      <td>20.9</td>\n","      <td>0.0</td>\n","      <td>3.2</td>\n","      <td>10.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>...</td>\n","      <td>0.0</td>\n","      <td>11.0</td>\n","      <td>54.0</td>\n","      <td>29.0</td>\n","      <td>1026.8</td>\n","      <td>1024.0</td>\n","      <td>2.0</td>\n","      <td>0.0</td>\n","      <td>11.7</td>\n","      <td>20.3</td>\n","    </tr>\n","    <tr>\n","      <th>3413</th>\n","      <td>2009-03-27</td>\n","      <td>Woomera</td>\n","      <td>15.2</td>\n","      <td>30.0</td>\n","      <td>0.0</td>\n","      <td>8.5</td>\n","      <td>11.2</td>\n","      <td>SSE</td>\n","      <td>43.0</td>\n","      <td>SSE</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>17.0</td>\n","      <td>52.0</td>\n","      <td>20.0</td>\n","      <td>1024.9</td>\n","      <td>1021.6</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>16.9</td>\n","      <td>28.3</td>\n","    </tr>\n","    <tr>\n","      <th>396</th>\n","      <td>2013-01-01</td>\n","      <td>Woomera</td>\n","      <td>21.5</td>\n","      <td>40.4</td>\n","      <td>0.0</td>\n","      <td>42.2</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>54.0</td>\n","      <td>ESE</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>26.0</td>\n","      <td>17.0</td>\n","      <td>3.0</td>\n","      <td>1014.5</td>\n","      <td>1012.1</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>28.1</td>\n","      <td>39.6</td>\n","    </tr>\n","    <tr>\n","      <th>2867</th>\n","      <td>2009-10-07</td>\n","      <td>Woomera</td>\n","      <td>9.0</td>\n","      <td>21.5</td>\n","      <td>0.0</td>\n","      <td>7.8</td>\n","      <td>11.9</td>\n","      <td>SE</td>\n","      <td>35.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>22.0</td>\n","      <td>15.0</td>\n","      <td>52.0</td>\n","      <td>20.0</td>\n","      <td>1025.6</td>\n","      <td>1024.3</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>12.4</td>\n","      <td>19.9</td>\n","    </tr>\n","    <tr>\n","      <th>1741</th>\n","      <td>2010-03-12</td>\n","      <td>Woomera</td>\n","      <td>14.0</td>\n","      <td>30.7</td>\n","      <td>0.0</td>\n","      <td>12.0</td>\n","      <td>11.4</td>\n","      <td>E</td>\n","      <td>37.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>13.0</td>\n","      <td>42.0</td>\n","      <td>26.0</td>\n","      <td>1028.3</td>\n","      <td>1025.0</td>\n","      <td>1.0</td>\n","      <td>1.0</td>\n","      <td>17.9</td>\n","      <td>28.9</td>\n","    </tr>\n","    <tr>\n","      <th>2380</th>\n","      <td>2013-01-15</td>\n","      <td>Woomera</td>\n","      <td>19.0</td>\n","      <td>36.3</td>\n","      <td>0.0</td>\n","      <td>13.0</td>\n","      <td>13.0</td>\n","      <td>ENE</td>\n","      <td>33.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>15.0</td>\n","      <td>17.0</td>\n","      <td>6.0</td>\n","      <td>1014.2</td>\n","      <td>NaN</td>\n","      <td>2.0</td>\n","      <td>1.0</td>\n","      <td>25.6</td>\n","      <td>35.0</td>\n","    </tr>\n","    <tr>\n","      <th>975</th>\n","      <td>2015-02-26</td>\n","      <td>Woomera</td>\n","      <td>17.5</td>\n","      <td>36.5</td>\n","      <td>0.0</td>\n","      <td>15.0</td>\n","      <td>NaN</td>\n","      <td>SSE</td>\n","      <td>39.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>20.0</td>\n","      <td>37.0</td>\n","      <td>6.0</td>\n","      <td>1011.3</td>\n","      <td>1008.5</td>\n","      <td>1.0</td>\n","      <td>0.0</td>\n","      <td>23.1</td>\n","      <td>34.7</td>\n","    </tr>\n","    <tr>\n","      <th>1716</th>\n","      <td>2016-12-19</td>\n","      <td>Woomera</td>\n","      <td>18.9</td>\n","      <td>33.0</td>\n","      <td>0.0</td>\n","      <td>10.8</td>\n","      <td>NaN</td>\n","      <td>WSW</td>\n","      <td>46.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>26.0</td>\n","      <td>24.0</td>\n","      <td>20.0</td>\n","      <td>32.0</td>\n","      <td>1012.1</td>\n","      <td>1009.8</td>\n","      <td>5.0</td>\n","      <td>7.0</td>\n","      <td>27.2</td>\n","      <td>29.7</td>\n","    </tr>\n","    <tr>\n","      <th>2569</th>\n","      <td>2009-08-06</td>\n","      <td>Woomera</td>\n","      <td>10.7</td>\n","      <td>25.1</td>\n","      <td>0.0</td>\n","      <td>9.6</td>\n","      <td>10.4</td>\n","      <td>NNW</td>\n","      <td>57.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>37.0</td>\n","      <td>32.0</td>\n","      <td>12.0</td>\n","      <td>1017.6</td>\n","      <td>1012.5</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>15.8</td>\n","      <td>24.5</td>\n","    </tr>\n","    <tr>\n","      <th>355</th>\n","      <td>2013-06-23</td>\n","      <td>Woomera</td>\n","      <td>7.8</td>\n","      <td>16.0</td>\n","      <td>1.2</td>\n","      <td>3.2</td>\n","      <td>7.4</td>\n","      <td>W</td>\n","      <td>37.0</td>\n","      <td>WNW</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>26.0</td>\n","      <td>97.0</td>\n","      <td>54.0</td>\n","      <td>1020.9</td>\n","      <td>1019.4</td>\n","      <td>5.0</td>\n","      <td>6.0</td>\n","      <td>9.7</td>\n","      <td>15.6</td>\n","    </tr>\n","    <tr>\n","      <th>592</th>\n","      <td>2013-04-03</td>\n","      <td>Woomera</td>\n","      <td>15.2</td>\n","      <td>26.9</td>\n","      <td>0.0</td>\n","      <td>6.8</td>\n","      <td>10.7</td>\n","      <td>SSE</td>\n","      <td>41.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>22.0</td>\n","      <td>13.0</td>\n","      <td>82.0</td>\n","      <td>33.0</td>\n","      <td>1023.3</td>\n","      <td>1021.0</td>\n","      <td>1.0</td>\n","      <td>4.0</td>\n","      <td>17.4</td>\n","      <td>26.2</td>\n","    </tr>\n","    <tr>\n","      <th>343</th>\n","      <td>2009-12-06</td>\n","      <td>Woomera</td>\n","      <td>16.1</td>\n","      <td>33.1</td>\n","      <td>0.0</td>\n","      <td>12.8</td>\n","      <td>13.1</td>\n","      <td>SSW</td>\n","      <td>39.0</td>\n","      <td>ESE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>17.0</td>\n","      <td>42.0</td>\n","      <td>12.0</td>\n","      <td>1016.7</td>\n","      <td>1013.4</td>\n","      <td>4.0</td>\n","      <td>6.0</td>\n","      <td>22.8</td>\n","      <td>32.1</td>\n","    </tr>\n","    <tr>\n","      <th>1994</th>\n","      <td>2015-06-06</td>\n","      <td>Woomera</td>\n","      <td>6.6</td>\n","      <td>20.2</td>\n","      <td>0.0</td>\n","      <td>6.6</td>\n","      <td>9.0</td>\n","      <td>NNE</td>\n","      <td>31.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>11.0</td>\n","      <td>17.0</td>\n","      <td>65.0</td>\n","      <td>39.0</td>\n","      <td>1030.1</td>\n","      <td>1026.3</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>12.7</td>\n","      <td>19.4</td>\n","    </tr>\n","    <tr>\n","      <th>2811</th>\n","      <td>2009-03-23</td>\n","      <td>Woomera</td>\n","      <td>13.4</td>\n","      <td>30.7</td>\n","      <td>0.0</td>\n","      <td>14.6</td>\n","      <td>10.8</td>\n","      <td>SSE</td>\n","      <td>35.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>26.0</td>\n","      <td>9.0</td>\n","      <td>48.0</td>\n","      <td>16.0</td>\n","      <td>1015.1</td>\n","      <td>1012.2</td>\n","      <td>1.0</td>\n","      <td>1.0</td>\n","      <td>16.6</td>\n","      <td>28.6</td>\n","    </tr>\n","    <tr>\n","      <th>1629</th>\n","      <td>2010-07-17</td>\n","      <td>Woomera</td>\n","      <td>5.1</td>\n","      <td>17.0</td>\n","      <td>0.0</td>\n","      <td>2.0</td>\n","      <td>9.5</td>\n","      <td>N</td>\n","      <td>37.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>15.0</td>\n","      <td>72.0</td>\n","      <td>43.0</td>\n","      <td>1026.4</td>\n","      <td>1022.4</td>\n","      <td>3.0</td>\n","      <td>4.0</td>\n","      <td>9.4</td>\n","      <td>15.8</td>\n","    </tr>\n","    <tr>\n","      <th>320</th>\n","      <td>2014-11-04</td>\n","      <td>Woomera</td>\n","      <td>17.4</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>12.0</td>\n","      <td>11.0</td>\n","      <td>S</td>\n","      <td>54.0</td>\n","      <td>WNW</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>30.0</td>\n","      <td>5.0</td>\n","      <td>24.0</td>\n","      <td>1016.2</td>\n","      <td>1016.1</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>25.7</td>\n","      <td>28.1</td>\n","    </tr>\n","    <tr>\n","      <th>1072</th>\n","      <td>2016-12-04</td>\n","      <td>Woomera</td>\n","      <td>24.2</td>\n","      <td>38.7</td>\n","      <td>0.0</td>\n","      <td>10.6</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>80.0</td>\n","      <td>SSW</td>\n","      <td>...</td>\n","      <td>13.0</td>\n","      <td>24.0</td>\n","      <td>43.0</td>\n","      <td>23.0</td>\n","      <td>1008.4</td>\n","      <td>1004.5</td>\n","      <td>7.0</td>\n","      <td>3.0</td>\n","      <td>28.3</td>\n","      <td>36.4</td>\n","    </tr>\n","    <tr>\n","      <th>2223</th>\n","      <td>2009-05-08</td>\n","      <td>Woomera</td>\n","      <td>9.2</td>\n","      <td>20.6</td>\n","      <td>0.0</td>\n","      <td>5.2</td>\n","      <td>10.4</td>\n","      <td>ESE</td>\n","      <td>37.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>19.0</td>\n","      <td>64.0</td>\n","      <td>34.0</td>\n","      <td>1030.5</td>\n","      <td>1026.9</td>\n","      <td>0.0</td>\n","      <td>1.0</td>\n","      <td>13.7</td>\n","      <td>20.1</td>\n","    </tr>\n","    <tr>\n","      <th>1984</th>\n","      <td>2014-05-26</td>\n","      <td>Woomera</td>\n","      <td>15.5</td>\n","      <td>23.6</td>\n","      <td>0.0</td>\n","      <td>24.0</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>43.0</td>\n","      <td>NNE</td>\n","      <td>...</td>\n","      <td>9.0</td>\n","      <td>26.0</td>\n","      <td>49.0</td>\n","      <td>37.0</td>\n","      <td>1014.2</td>\n","      <td>1010.3</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>18.0</td>\n","      <td>21.5</td>\n","    </tr>\n","    <tr>\n","      <th>1592</th>\n","      <td>2012-01-10</td>\n","      <td>Woomera</td>\n","      <td>16.8</td>\n","      <td>26.7</td>\n","      <td>0.0</td>\n","      <td>10.0</td>\n","      <td>5.3</td>\n","      <td>SW</td>\n","      <td>46.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>20.0</td>\n","      <td>22.0</td>\n","      <td>52.0</td>\n","      <td>33.0</td>\n","      <td>1019.1</td>\n","      <td>1016.8</td>\n","      <td>4.0</td>\n","      <td>6.0</td>\n","      <td>18.3</td>\n","      <td>24.9</td>\n","    </tr>\n","    <tr>\n","      <th>2824</th>\n","      <td>2015-11-03</td>\n","      <td>Woomera</td>\n","      <td>16.2</td>\n","      <td>28.5</td>\n","      <td>7.8</td>\n","      <td>4.2</td>\n","      <td>4.5</td>\n","      <td>WSW</td>\n","      <td>80.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>26.0</td>\n","      <td>50.0</td>\n","      <td>76.0</td>\n","      <td>53.0</td>\n","      <td>1009.6</td>\n","      <td>1006.8</td>\n","      <td>6.0</td>\n","      <td>7.0</td>\n","      <td>20.5</td>\n","      <td>26.2</td>\n","    </tr>\n","    <tr>\n","      <th>1005</th>\n","      <td>2010-05-14</td>\n","      <td>Woomera</td>\n","      <td>3.9</td>\n","      <td>19.3</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>10.5</td>\n","      <td>NE</td>\n","      <td>33.0</td>\n","      <td>ENE</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>13.0</td>\n","      <td>43.0</td>\n","      <td>19.0</td>\n","      <td>1020.2</td>\n","      <td>1016.4</td>\n","      <td>1.0</td>\n","      <td>1.0</td>\n","      <td>11.5</td>\n","      <td>18.5</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>3500 rows × 21 columns</p>\n","</div>"],"text/plain":["            Date  Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","2796  2015-03-24  Adelaide     12.3     19.3       0.0          5.0       NaN   \n","2975  2012-08-17  Adelaide      7.8     13.2      17.6          0.8       NaN   \n","775   2013-03-16  Adelaide     17.4     23.8       NaN          NaN       9.7   \n","861   2011-07-12  Adelaide      7.9     11.4       0.0          1.0       0.5   \n","2906  2015-08-24  Adelaide      9.2     14.3       0.0          NaN       NaN   \n","2900  2009-09-17  Adelaide     14.2     17.4       8.8          2.0       7.1   \n","902   2008-12-10  Adelaide     14.2     28.0       0.0          6.4      12.5   \n","919   2011-10-12  Adelaide      7.7     19.9       0.0          3.4      11.4   \n","936   2014-03-11  Adelaide     22.3     32.2       0.4         20.6       3.2   \n","942   2015-02-23  Adelaide     20.6     26.5       0.0         16.2       NaN   \n","999   2009-11-30  Adelaide     13.1     22.4       0.6         13.6      10.4   \n","1013  2012-08-23  Adelaide      8.1     12.4       6.0          1.8       NaN   \n","1042  2008-11-03  Adelaide     13.3     21.2       0.0         15.2      10.0   \n","701   2009-01-08  Adelaide     14.3     23.8       0.0          7.4      12.7   \n","109   2012-05-02  Adelaide      9.4     16.5      12.4          0.8       NaN   \n","227   2016-08-31  Adelaide     11.9     16.8       1.0          NaN       NaN   \n","1190  2015-07-01  Adelaide      4.7     14.5       0.0          NaN       NaN   \n","2701  2013-05-16  Adelaide     10.7     17.5       7.0          1.4       7.1   \n","1227  2016-06-22  Adelaide     10.2     16.5      11.8          NaN       NaN   \n","1234  2017-01-09  Adelaide     20.2     30.4       0.0          NaN       NaN   \n","1266  2008-11-07  Adelaide     18.3     22.5       0.2          8.0       1.4   \n","1282  2012-09-03  Adelaide      7.7     22.9       0.0          7.0       NaN   \n","1289  2010-03-09  Adelaide     14.3     22.0       1.6         16.4       7.8   \n","86    2010-11-08  Adelaide     13.7     23.1       0.0         16.0      12.2   \n","83    2012-10-08  Adelaide     10.2     23.6       0.2         10.0       NaN   \n","1356  2014-03-05  Adelaide     16.7     24.8       0.0          6.6      11.7   \n","1390  2015-10-04  Adelaide     15.4     29.7       0.0          NaN       NaN   \n","107   2015-10-01  Adelaide      7.8     24.4       0.0          NaN       NaN   \n","3403  2015-12-05  Adelaide     20.7     40.2       0.0          NaN       NaN   \n","3023  2012-11-06  Adelaide     14.7     22.8       8.0          3.2       NaN   \n","...          ...       ...      ...      ...       ...          ...       ...   \n","179   2015-12-20   Woomera     27.1     31.3       0.4         18.0       2.1   \n","212   2009-06-25   Woomera      9.1     18.4       0.0          3.8       4.4   \n","1392  2015-11-06   Woomera     13.1     28.3       0.0          NaN       NaN   \n","1436  2009-10-19   Woomera     12.6     30.0       0.0          7.8      12.3   \n","1431  2012-01-16   Woomera     18.9     38.8       0.0         12.0      12.4   \n","204   2014-02-05   Woomera     23.1     38.6       0.0         19.8       6.3   \n","225   2013-08-23   Woomera      6.5     17.7       0.0          3.8       3.6   \n","400   2016-02-09   Woomera     20.2     39.4       0.0         17.6      12.8   \n","1174  2011-07-27   Woomera      4.9     20.9       0.0          3.2      10.0   \n","3413  2009-03-27   Woomera     15.2     30.0       0.0          8.5      11.2   \n","396   2013-01-01   Woomera     21.5     40.4       0.0         42.2       NaN   \n","2867  2009-10-07   Woomera      9.0     21.5       0.0          7.8      11.9   \n","1741  2010-03-12   Woomera     14.0     30.7       0.0         12.0      11.4   \n","2380  2013-01-15   Woomera     19.0     36.3       0.0         13.0      13.0   \n","975   2015-02-26   Woomera     17.5     36.5       0.0         15.0       NaN   \n","1716  2016-12-19   Woomera     18.9     33.0       0.0         10.8       NaN   \n","2569  2009-08-06   Woomera     10.7     25.1       0.0          9.6      10.4   \n","355   2013-06-23   Woomera      7.8     16.0       1.2          3.2       7.4   \n","592   2013-04-03   Woomera     15.2     26.9       0.0          6.8      10.7   \n","343   2009-12-06   Woomera     16.1     33.1       0.0         12.8      13.1   \n","1994  2015-06-06   Woomera      6.6     20.2       0.0          6.6       9.0   \n","2811  2009-03-23   Woomera     13.4     30.7       0.0         14.6      10.8   \n","1629  2010-07-17   Woomera      5.1     17.0       0.0          2.0       9.5   \n","320   2014-11-04   Woomera     17.4     29.8       0.0         12.0      11.0   \n","1072  2016-12-04   Woomera     24.2     38.7       0.0         10.6       NaN   \n","2223  2009-05-08   Woomera      9.2     20.6       0.0          5.2      10.4   \n","1984  2014-05-26   Woomera     15.5     23.6       0.0         24.0       NaN   \n","1592  2012-01-10   Woomera     16.8     26.7       0.0         10.0       5.3   \n","2824  2015-11-03   Woomera     16.2     28.5       7.8          4.2       4.5   \n","1005  2010-05-14   Woomera      3.9     19.3       0.0          5.8      10.5   \n","\n","     WindGustDir  WindGustSpeed WindDir9am   ...    WindSpeed9am  \\\n","2796           S           39.0          S   ...            13.0   \n","2975          SW           61.0         SW   ...            20.0   \n","775          SSE           46.0          S   ...             9.0   \n","861            N           20.0        NNE   ...             7.0   \n","2906          SE           48.0         SE   ...            17.0   \n","2900          SW           41.0        SSW   ...            15.0   \n","902           SE           48.0          E   ...            13.0   \n","919            W           30.0          E   ...            13.0   \n","936            W           65.0        ESE   ...             9.0   \n","942          SSE           48.0          S   ...            20.0   \n","999          SSE           37.0        SSE   ...            17.0   \n","1013         WNW           74.0         NW   ...            26.0   \n","1042         SSE           39.0        SSW   ...            15.0   \n","701           SE           37.0         SE   ...            17.0   \n","109          SSE           39.0          S   ...             9.0   \n","227           SW           28.0        WNW   ...            11.0   \n","1190         WSW           20.0         NE   ...             6.0   \n","2701          SW           35.0         NE   ...             6.0   \n","1227         WNW           39.0          W   ...             9.0   \n","1234          SW           24.0        ESE   ...             6.0   \n","1266         WNW           56.0          N   ...            17.0   \n","1282          SE           56.0          N   ...            13.0   \n","1289          SW           39.0          S   ...            11.0   \n","86             W           31.0        WNW   ...            13.0   \n","83             E           33.0        NNE   ...            11.0   \n","1356           S           37.0          S   ...            15.0   \n","1390         WNW           20.0        NaN   ...             0.0   \n","107          WSW           22.0          N   ...             9.0   \n","3403          SE           31.0         NE   ...             9.0   \n","3023          NW           31.0          W   ...            17.0   \n","...          ...            ...        ...   ...             ...   \n","179           SE           56.0        ENE   ...            11.0   \n","212            N           41.0        NNE   ...            19.0   \n","1392          SE           33.0        SSE   ...            19.0   \n","1436           N           44.0          N   ...            13.0   \n","1431           N           41.0        ENE   ...            20.0   \n","204           SE           37.0        ESE   ...            17.0   \n","225           SW           43.0        WSW   ...            22.0   \n","400          SSE           43.0         SE   ...            24.0   \n","1174         NaN            NaN        NaN   ...             0.0   \n","3413         SSE           43.0        SSE   ...            20.0   \n","396           SE           54.0        ESE   ...            20.0   \n","2867          SE           35.0         SE   ...            22.0   \n","1741           E           37.0         SE   ...            20.0   \n","2380         ENE           33.0          E   ...            24.0   \n","975          SSE           39.0         SE   ...            20.0   \n","1716         WSW           46.0        NNE   ...            26.0   \n","2569         NNW           57.0          N   ...            24.0   \n","355            W           37.0        WNW   ...            19.0   \n","592          SSE           41.0         SE   ...            22.0   \n","343          SSW           39.0        ESE   ...            17.0   \n","1994         NNE           31.0         NE   ...            11.0   \n","2811         SSE           35.0         SE   ...            26.0   \n","1629           N           37.0        NNE   ...            15.0   \n","320            S           54.0        WNW   ...            13.0   \n","1072         NNW           80.0        SSW   ...            13.0   \n","2223         ESE           37.0         SE   ...            19.0   \n","1984         NNW           43.0        NNE   ...             9.0   \n","1592          SW           46.0          S   ...            20.0   \n","2824         WSW           80.0         NE   ...            26.0   \n","1005          NE           33.0        ENE   ...            15.0   \n","\n","      WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  \\\n","2796          19.0         59.0         47.0       1022.2       1021.4   \n","2975          28.0         76.0         47.0       1012.5       1014.7   \n","775           19.0         63.0         57.0       1019.9       1020.5   \n","861            7.0         70.0         59.0       1028.7       1025.7   \n","2906          19.0         64.0         42.0       1024.7       1024.1   \n","2900          20.0         82.0         56.0       1014.9       1018.0   \n","902           13.0         56.0         35.0       1010.8       1008.9   \n","919           15.0         56.0         43.0       1021.2       1018.1   \n","936            9.0         53.0         78.0       1017.0       1017.2   \n","942           22.0         61.0         43.0       1015.3       1016.5   \n","999           15.0         66.0         43.0       1017.9       1016.8   \n","1013          37.0         74.0         78.0       1002.6       1005.6   \n","1042          20.0         50.0         39.0       1021.9       1020.1   \n","701           22.0         45.0         30.0       1019.9       1019.2   \n","109           15.0         53.0         47.0       1029.6       1028.5   \n","227           13.0         80.0         79.0       1018.5       1017.7   \n","1190          13.0         78.0         48.0       1030.6       1027.6   \n","2701          19.0         88.0         54.0       1016.3       1015.9   \n","1227          17.0         67.0         63.0       1010.3       1010.0   \n","1234           9.0         70.0         38.0       1012.7       1011.3   \n","1266          28.0         58.0         51.0       1001.0       1004.7   \n","1282          17.0         27.0         22.0       1021.1       1018.2   \n","1289          20.0         75.0         36.0       1021.2       1022.5   \n","86            17.0         61.0         38.0       1016.0       1016.3   \n","83            17.0         46.0         28.0       1016.7       1012.9   \n","1356          24.0         61.0         48.0       1019.3       1018.9   \n","1390           9.0         44.0         22.0       1024.0       1022.4   \n","107           15.0         35.0         23.0       1028.4       1028.6   \n","3403          13.0         18.0         13.0       1015.3       1012.1   \n","3023          15.0         64.0         46.0       1011.9       1011.6   \n","...            ...          ...          ...          ...          ...   \n","179           35.0         37.0         41.0       1007.7       1007.7   \n","212           20.0         54.0         90.0       1012.9       1008.8   \n","1392           7.0         65.0         36.0       1015.9       1013.2   \n","1436          22.0         20.0          8.0       1025.5       1021.3   \n","1431          20.0         10.0          5.0       1012.0       1008.7   \n","204            6.0         18.0         11.0       1012.1       1009.9   \n","225           26.0         76.0         46.0       1024.2       1022.9   \n","400            9.0         50.0         12.0       1016.8       1013.3   \n","1174          11.0         54.0         29.0       1026.8       1024.0   \n","3413          17.0         52.0         20.0       1024.9       1021.6   \n","396           26.0         17.0          3.0       1014.5       1012.1   \n","2867          15.0         52.0         20.0       1025.6       1024.3   \n","1741          13.0         42.0         26.0       1028.3       1025.0   \n","2380          15.0         17.0          6.0       1014.2          NaN   \n","975           20.0         37.0          6.0       1011.3       1008.5   \n","1716          24.0         20.0         32.0       1012.1       1009.8   \n","2569          37.0         32.0         12.0       1017.6       1012.5   \n","355           26.0         97.0         54.0       1020.9       1019.4   \n","592           13.0         82.0         33.0       1023.3       1021.0   \n","343           17.0         42.0         12.0       1016.7       1013.4   \n","1994          17.0         65.0         39.0       1030.1       1026.3   \n","2811           9.0         48.0         16.0       1015.1       1012.2   \n","1629          15.0         72.0         43.0       1026.4       1022.4   \n","320           30.0          5.0         24.0       1016.2       1016.1   \n","1072          24.0         43.0         23.0       1008.4       1004.5   \n","2223          19.0         64.0         34.0       1030.5       1026.9   \n","1984          26.0         49.0         37.0       1014.2       1010.3   \n","1592          22.0         52.0         33.0       1019.1       1016.8   \n","2824          50.0         76.0         53.0       1009.6       1006.8   \n","1005          13.0         43.0         19.0       1020.2       1016.4   \n","\n","      Cloud9am  Cloud3pm  Temp9am  Temp3pm  \n","2796       NaN       NaN     15.1     17.7  \n","2975       NaN       NaN      8.3     12.5  \n","775        NaN       NaN     19.1     20.7  \n","861        NaN       NaN      8.4     11.3  \n","2906       NaN       NaN      9.9     13.4  \n","2900       NaN       NaN     16.2     16.7  \n","902        NaN       NaN     19.3     25.6  \n","919        NaN       NaN     14.1     19.4  \n","936        NaN       NaN     25.6     22.8  \n","942        NaN       NaN     22.2     25.7  \n","999        NaN       NaN     16.1     20.9  \n","1013       NaN       NaN     10.7      7.4  \n","1042       NaN       NaN     14.8     19.9  \n","701        NaN       NaN     17.6     23.2  \n","109        NaN       NaN     13.5     14.6  \n","227        NaN       NaN     14.3     15.2  \n","1190       NaN       NaN      8.8     13.1  \n","2701       NaN       NaN     13.1     16.9  \n","1227       NaN       NaN     13.5     15.5  \n","1234       NaN       NaN     20.9     28.9  \n","1266       NaN       NaN     22.4     18.4  \n","1282       NaN       NaN     17.5     22.1  \n","1289       NaN       NaN     16.8     21.6  \n","86         NaN       NaN     17.2     22.5  \n","83         NaN       NaN     15.1     22.6  \n","1356       NaN       NaN     20.8     23.7  \n","1390       NaN       NaN     18.3     27.4  \n","107        NaN       NaN     19.1     23.8  \n","3403       NaN       NaN     33.4     38.6  \n","3023       NaN       NaN     17.7     21.0  \n","...        ...       ...      ...      ...  \n","179        1.0       NaN     30.4     29.7  \n","212        6.0       8.0     13.2     14.2  \n","1392       NaN       NaN     17.6     26.0  \n","1436       0.0       0.0     19.9     28.7  \n","1431       0.0       0.0     27.6     37.9  \n","204        3.0       2.0     26.8     36.2  \n","225        1.0       7.0     13.2     17.3  \n","400        NaN       NaN     24.0     37.7  \n","1174       2.0       0.0     11.7     20.3  \n","3413       0.0       0.0     16.9     28.3  \n","396        0.0       0.0     28.1     39.6  \n","2867       0.0       0.0     12.4     19.9  \n","1741       1.0       1.0     17.9     28.9  \n","2380       2.0       1.0     25.6     35.0  \n","975        1.0       0.0     23.1     34.7  \n","1716       5.0       7.0     27.2     29.7  \n","2569       0.0       0.0     15.8     24.5  \n","355        5.0       6.0      9.7     15.6  \n","592        1.0       4.0     17.4     26.2  \n","343        4.0       6.0     22.8     32.1  \n","1994       0.0       0.0     12.7     19.4  \n","2811       1.0       1.0     16.6     28.6  \n","1629       3.0       4.0      9.4     15.8  \n","320        0.0       0.0     25.7     28.1  \n","1072       7.0       3.0     28.3     36.4  \n","2223       0.0       1.0     13.7     20.1  \n","1984       7.0       7.0     18.0     21.5  \n","1592       4.0       6.0     18.3     24.9  \n","2824       6.0       7.0     20.5     26.2  \n","1005       1.0       1.0     11.5     18.5  \n","\n","[3500 rows x 21 columns]"]},"metadata":{"tags":[]},"execution_count":32}]},{"metadata":{"id":"J9ppQbTwJGxB","colab_type":"code","colab":{}},"cell_type":"code","source":["#不同地点上一段相似的时间的数据"],"execution_count":0,"outputs":[]},{"metadata":{"id":"o9LOtPB9JGxJ","colab_type":"code","outputId":"f6c7e677-9c52-4e1f-a2ec-0c163124f881","executionInfo":{"status":"ok","timestamp":1546764351159,"user_tz":-480,"elapsed":1785,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":194}},"cell_type":"code","source":["Xtrain.loc[Xtrain.iloc[:,0] == \"2015-08-24\",:]"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed9am</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>2906</th>\n","      <td>2015-08-24</td>\n","      <td>Adelaide</td>\n","      <td>9.2</td>\n","      <td>14.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SE</td>\n","      <td>48.0</td>\n","      <td>SE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>19.0</td>\n","      <td>64.0</td>\n","      <td>42.0</td>\n","      <td>1024.7</td>\n","      <td>1024.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>9.9</td>\n","      <td>13.4</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>2 rows × 21 columns</p>\n","</div>"],"text/plain":["            Date   Location  MinTemp  MaxTemp  Rainfall  Evaporation  \\\n","0     2015-08-24  Katherine     17.5     36.0       0.0          8.8   \n","2906  2015-08-24   Adelaide      9.2     14.3       0.0          NaN   \n","\n","      Sunshine WindGustDir  WindGustSpeed WindDir9am   ...    WindSpeed9am  \\\n","0          NaN         ESE           26.0        NNW   ...            17.0   \n","2906       NaN          SE           48.0         SE   ...            17.0   \n","\n","      WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  \\\n","0             15.0         57.0          NaN       1016.8       1012.2   \n","2906          19.0         64.0         42.0       1024.7       1024.1   \n","\n","      Cloud9am  Cloud3pm  Temp9am  Temp3pm  \n","0          0.0       NaN     27.5      NaN  \n","2906       NaN       NaN      9.9     13.4  \n","\n","[2 rows x 21 columns]"]},"metadata":{"tags":[]},"execution_count":33}]},{"metadata":{"id":"Ncm7jenYJGxT","colab_type":"code","colab":{}},"cell_type":"code","source":["#首先，日期不是独一无二的，日期有重复\n","#其次，在我们分训练集和测试集之后，日期也不是连续的，而是分散的\n","#某一年的某一天倾向于会下雨？或者倾向于不会下雨吗？\n","#不是日期影响了下雨与否，反而更多的是这一天的日照时间，湿度，温度等等这些因素影响了是否会下雨\n","#光看日期，其实感觉它对我们的判断并无直接影响\n","#如果我们把它当作连续型变量处理，那算法会人为它是一系列1~3000左右的数字，不会意识到这是日期"],"execution_count":0,"outputs":[]},{"metadata":{"id":"T_UuIRCVJGxc","colab_type":"code","outputId":"b7e63f0a-4cf3-48c2-da3f-95f86a6cd009","executionInfo":{"status":"ok","timestamp":1546770859667,"user_tz":-480,"elapsed":762,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Xtrain.iloc[:,0].value_counts().count()\n","#如果我们把它当作分类型变量处理，类别太多，有2141类，如果换成数值型，会被直接当成连续型变量，如果做成哑变量，我们特征的维度会爆炸"],"execution_count":25,"outputs":[{"output_type":"execute_result","data":{"text/plain":["2141"]},"metadata":{"tags":[]},"execution_count":25}]},{"metadata":{"id":"994qZOFkJGxg","colab_type":"code","outputId":"df0a787b-a648-4ecf-93c8-76ac36544e81","executionInfo":{"status":"ok","timestamp":1546770862497,"user_tz":-480,"elapsed":1487,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":374}},"cell_type":"code","source":["Xtrain[\"Rainfall\"].head(20)"],"execution_count":26,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0      0.0\n","1      0.0\n","2      0.0\n","3      0.0\n","4      0.0\n","5      0.0\n","6      0.0\n","7      0.2\n","8      0.0\n","9      0.2\n","10     1.0\n","11     0.0\n","12     0.2\n","13     0.0\n","14     0.0\n","15     3.0\n","16     0.2\n","17     0.0\n","18    35.2\n","19     0.0\n","Name: Rainfall, dtype: float64"]},"metadata":{"tags":[]},"execution_count":26}]},{"metadata":{"id":"jmJ9wU4YJGxm","colab_type":"code","outputId":"985ea858-9092-430c-c035-e5c65bccef99","executionInfo":{"status":"ok","timestamp":1546770864547,"user_tz":-480,"elapsed":510,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Xtrain[\"Rainfall\"].isnull().sum()\n","#假设你没有下雨\n","#复制你的空值"],"execution_count":27,"outputs":[{"output_type":"execute_result","data":{"text/plain":["33"]},"metadata":{"tags":[]},"execution_count":27}]},{"metadata":{"id":"M-xwdI4MJGxv","colab_type":"code","outputId":"ba03da51-2a92-45e4-aac4-87bb5c2a34b4","executionInfo":{"status":"ok","timestamp":1546770866799,"user_tz":-480,"elapsed":767,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":241}},"cell_type":"code","source":["Xtrain.loc[Xtrain[\"Rainfall\"] >= 1,\"RainToday\"] = \"Yes\"\n","Xtrain.loc[Xtrain[\"Rainfall\"] < 1,\"RainToday\"] = \"No\"\n","Xtrain.loc[Xtrain[\"Rainfall\"] == np.nan,\"RainToday\"] = np.nan"],"execution_count":28,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:357: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[key] = _infer_fill_value(value)\n","/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:537: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[item] = s\n"],"name":"stderr"}]},{"metadata":{"id":"L2sd8HFlJGx0","colab_type":"code","outputId":"543d67f8-43aa-4cbe-d9ac-0d10f5b5b6cf","executionInfo":{"status":"ok","timestamp":1546765007015,"user_tz":-480,"elapsed":747,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2016-12-10</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-04-18</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2009-11-26</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2014-04-25</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["         Date     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0  2015-08-24    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1  2016-12-10  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2  2010-04-18       Albany     13.0     22.6       0.0          3.8      10.4   \n","3  2009-11-26         Sale     13.9     29.8       0.0          5.8       5.1   \n","4  2014-04-25      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         ESE           26.0        NNW    ...             15.0         57.0   \n","1         NNW           33.0         NE    ...             17.0         59.0   \n","2         NaN            NaN         NE    ...             31.0         79.0   \n","3           S           37.0          N    ...             28.0         82.0   \n","4         NNE           24.0          E    ...             15.0         58.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0          NaN       1016.8       1012.2       0.0       NaN     27.5   \n","1         31.0       1020.4       1017.5       NaN       NaN     14.6   \n","2         68.0       1020.3       1015.7       1.0       3.0     17.5   \n","3         44.0       1012.5       1005.9       6.0       6.0     18.5   \n","4         35.0       1019.8       1014.1       2.0       4.0     12.4   \n","\n","   Temp3pm  RainToday  \n","0      NaN         No  \n","1     23.6         No  \n","2     20.8         No  \n","3     27.5         No  \n","4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":37}]},{"metadata":{"id":"PVQqKUIyJGx4","colab_type":"code","outputId":"5ed23b2c-96eb-4055-aaa0-08cb10df82fd","executionInfo":{"status":"ok","timestamp":1546765014217,"user_tz":-480,"elapsed":771,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":68}},"cell_type":"code","source":["Xtrain.loc[:,\"RainToday\"].value_counts()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["No     2642\n","Yes     825\n","Name: RainToday, dtype: int64"]},"metadata":{"tags":[]},"execution_count":38}]},{"metadata":{"id":"3usOhbAGJGx8","colab_type":"code","outputId":"0b944065-4b5f-4c27-d77e-372ca3640929","executionInfo":{"status":"ok","timestamp":1546770875535,"user_tz":-480,"elapsed":771,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":241}},"cell_type":"code","source":["Xtest.loc[Xtest[\"Rainfall\"] >= 1,\"RainToday\"] = \"Yes\"\n","Xtest.loc[Xtest[\"Rainfall\"] < 1,\"RainToday\"] = \"No\"\n","Xtest.loc[Xtest[\"Rainfall\"] == np.nan,\"RainToday\"] = np.nan"],"execution_count":29,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:357: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[key] = _infer_fill_value(value)\n","/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:537: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[item] = s\n"],"name":"stderr"}]},{"metadata":{"id":"E0Hbs0PJJGyA","colab_type":"code","outputId":"8733ee40-9ac2-4625-c239-d68e08efbd54","executionInfo":{"status":"ok","timestamp":1546765023938,"user_tz":-480,"elapsed":1118,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2015-08-24</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2016-12-10</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-04-18</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2009-11-26</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2014-04-25</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["         Date     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0  2015-08-24    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1  2016-12-10  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2  2010-04-18       Albany     13.0     22.6       0.0          3.8      10.4   \n","3  2009-11-26         Sale     13.9     29.8       0.0          5.8       5.1   \n","4  2014-04-25      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         ESE           26.0        NNW    ...             15.0         57.0   \n","1         NNW           33.0         NE    ...             17.0         59.0   \n","2         NaN            NaN         NE    ...             31.0         79.0   \n","3           S           37.0          N    ...             28.0         82.0   \n","4         NNE           24.0          E    ...             15.0         58.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0          NaN       1016.8       1012.2       0.0       NaN     27.5   \n","1         31.0       1020.4       1017.5       NaN       NaN     14.6   \n","2         68.0       1020.3       1015.7       1.0       3.0     17.5   \n","3         44.0       1012.5       1005.9       6.0       6.0     18.5   \n","4         35.0       1019.8       1014.1       2.0       4.0     12.4   \n","\n","   Temp3pm  RainToday  \n","0      NaN         No  \n","1     23.6         No  \n","2     20.8         No  \n","3     27.5         No  \n","4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":40}]},{"metadata":{"id":"MlB7oI7xJGyE","colab_type":"code","outputId":"63bec44e-da83-4278-d3ea-bc1348cb1f5a","executionInfo":{"status":"ok","timestamp":1546765029009,"user_tz":-480,"elapsed":1180,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":338}},"cell_type":"code","source":["Xtest.head()"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Date</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2016-01-23</td>\n","      <td>NorahHead</td>\n","      <td>22.0</td>\n","      <td>27.8</td>\n","      <td>25.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SSW</td>\n","      <td>57.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>37.0</td>\n","      <td>91.0</td>\n","      <td>86.0</td>\n","      <td>1006.6</td>\n","      <td>1008.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>26.2</td>\n","      <td>23.1</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>2009-03-05</td>\n","      <td>MountGambier</td>\n","      <td>12.0</td>\n","      <td>18.6</td>\n","      <td>2.2</td>\n","      <td>3.0</td>\n","      <td>7.8</td>\n","      <td>SW</td>\n","      <td>52.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>88.0</td>\n","      <td>62.0</td>\n","      <td>1020.2</td>\n","      <td>1019.9</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","      <td>14.8</td>\n","      <td>17.5</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>2010-03-05</td>\n","      <td>MountGinini</td>\n","      <td>9.1</td>\n","      <td>13.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>41.0</td>\n","      <td>NaN</td>\n","      <td>...</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>2013-10-26</td>\n","      <td>Wollongong</td>\n","      <td>13.1</td>\n","      <td>20.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>33.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>40.0</td>\n","      <td>51.0</td>\n","      <td>1021.3</td>\n","      <td>1019.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>16.8</td>\n","      <td>19.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2016-11-28</td>\n","      <td>Sale</td>\n","      <td>12.2</td>\n","      <td>20.0</td>\n","      <td>0.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>E</td>\n","      <td>33.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>92.0</td>\n","      <td>69.0</td>\n","      <td>1015.6</td>\n","      <td>1013.2</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","      <td>13.6</td>\n","      <td>19.0</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["         Date      Location  MinTemp  MaxTemp  Rainfall  Evaporation  \\\n","0  2016-01-23     NorahHead     22.0     27.8      25.2          NaN   \n","1  2009-03-05  MountGambier     12.0     18.6       2.2          3.0   \n","2  2010-03-05   MountGinini      9.1     13.3       NaN          NaN   \n","3  2013-10-26    Wollongong     13.1     20.3       0.0          NaN   \n","4  2016-11-28          Sale     12.2     20.0       0.4          NaN   \n","\n","   Sunshine WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  \\\n","0       NaN         SSW           57.0          S    ...             37.0   \n","1       7.8          SW           52.0         SW    ...             28.0   \n","2       NaN          NE           41.0        NaN    ...              NaN   \n","3       NaN          SW           33.0          W    ...             24.0   \n","4       NaN           E           33.0         SW    ...             19.0   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0         91.0         86.0       1006.6       1008.1       NaN       NaN   \n","1         88.0         62.0       1020.2       1019.9       8.0       7.0   \n","2          NaN          NaN          NaN          NaN       NaN       NaN   \n","3         40.0         51.0       1021.3       1019.5       NaN       NaN   \n","4         92.0         69.0       1015.6       1013.2       8.0       4.0   \n","\n","   Temp9am  Temp3pm  RainToday  \n","0     26.2     23.1        Yes  \n","1     14.8     17.5        Yes  \n","2      NaN      NaN        NaN  \n","3     16.8     19.6         No  \n","4     13.6     19.0         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":41}]},{"metadata":{"id":"FFILvS5YYbVq","colab_type":"code","outputId":"0a21f733-860d-45dd-aeab-de2dfbfa159a","executionInfo":{"status":"ok","timestamp":1546770880220,"user_tz":-480,"elapsed":471,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Xtrain.loc[0,\"Date\"].split(\"-\")"],"execution_count":30,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['2015', '08', '24']"]},"metadata":{"tags":[]},"execution_count":30}]},{"metadata":{"id":"OCM9ZJGcJGyG","colab_type":"code","outputId":"55e1999f-c038-44a9-e7fe-0d7bbc5b26b9","executionInfo":{"status":"ok","timestamp":1546765041145,"user_tz":-480,"elapsed":851,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["int(Xtrain.loc[0,\"Date\"].split(\"-\")[1]) #提取出月份"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["8"]},"metadata":{"tags":[]},"execution_count":42}]},{"metadata":{"id":"jMMAnyERJGyI","colab_type":"code","outputId":"49cdfae4-23ee-4c8f-b3c5-f0b9d47cebca","executionInfo":{"status":"ok","timestamp":1546770883578,"user_tz":-480,"elapsed":932,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":139}},"cell_type":"code","source":["Xtrain[\"Date\"] = Xtrain[\"Date\"].apply(lambda x:int(x.split(\"-\")[1]))\n","#apply是对dataframe上的某一列进行处理的一个函数\n","#lambda x匿名函数，请在dataframe上这一列中的每一行帮我执行冒号后的命令"],"execution_count":31,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  \"\"\"Entry point for launching an IPython kernel.\n"],"name":"stderr"}]},{"metadata":{"id":"7xj50PjqJGyK","colab_type":"code","outputId":"67de8a2e-a00e-41fc-c519-f2120c245f27","executionInfo":{"status":"ok","timestamp":1546770886198,"user_tz":-480,"elapsed":757,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":238}},"cell_type":"code","source":["Xtrain.loc[:,\"Date\"].value_counts()"],"execution_count":32,"outputs":[{"output_type":"execute_result","data":{"text/plain":["3     334\n","5     324\n","7     316\n","9     302\n","6     302\n","1     300\n","11    299\n","10    282\n","4     265\n","2     264\n","12    259\n","8     253\n","Name: Date, dtype: int64"]},"metadata":{"tags":[]},"execution_count":32}]},{"metadata":{"id":"sycbrFAaJGyN","colab_type":"code","colab":{}},"cell_type":"code","source":["#替换完毕后，我们需要修改列的名称\n","#rename是比较少用的，可以用来修改单个列名的函数\n","#我们通常都直接使用 df.columns = 某个列表 这样的形式来一次修改所有的列名\n","#但rename允许我们只修改某个单独的列\n","Xtrain = Xtrain.rename(columns={\"Date\":\"Month\"})"],"execution_count":0,"outputs":[]},{"metadata":{"id":"vHWaOwwaJGyQ","colab_type":"code","outputId":"f83827e6-e7f8-4353-fb5d-b69aef0ac03d","executionInfo":{"status":"ok","timestamp":1546770891370,"user_tz":-480,"elapsed":593,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":253}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":34,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      8    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1     12  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2      4       Albany     13.0     22.6       0.0          3.8      10.4   \n","3     11         Sale     13.9     29.8       0.0          5.8       5.1   \n","4      4      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         ESE           26.0        NNW    ...             15.0         57.0   \n","1         NNW           33.0         NE    ...             17.0         59.0   \n","2         NaN            NaN         NE    ...             31.0         79.0   \n","3           S           37.0          N    ...             28.0         82.0   \n","4         NNE           24.0          E    ...             15.0         58.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0          NaN       1016.8       1012.2       0.0       NaN     27.5   \n","1         31.0       1020.4       1017.5       NaN       NaN     14.6   \n","2         68.0       1020.3       1015.7       1.0       3.0     17.5   \n","3         44.0       1012.5       1005.9       6.0       6.0     18.5   \n","4         35.0       1019.8       1014.1       2.0       4.0     12.4   \n","\n","   Temp3pm  RainToday  \n","0      NaN         No  \n","1     23.6         No  \n","2     20.8         No  \n","3     27.5         No  \n","4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":34}]},{"metadata":{"id":"EeF2QYqXJGyU","colab_type":"code","outputId":"56007a0a-00a4-408c-b2a3-d17b94d7bd36","executionInfo":{"status":"ok","timestamp":1546770894074,"user_tz":-480,"elapsed":882,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":139}},"cell_type":"code","source":["Xtest[\"Date\"] = Xtest[\"Date\"].apply(lambda x:int(x.split(\"-\")[1]))\n","Xtest = Xtest.rename(columns={\"Date\":\"Month\"})"],"execution_count":35,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  \"\"\"Entry point for launching an IPython kernel.\n"],"name":"stderr"}]},{"metadata":{"id":"6bFsyWmIJGyW","colab_type":"code","outputId":"db9d835d-dc88-4a2c-d7c4-5eeffe1f523d","executionInfo":{"status":"ok","timestamp":1546770896214,"user_tz":-480,"elapsed":1051,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":253}},"cell_type":"code","source":["Xtest.head()"],"execution_count":36,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>1</td>\n","      <td>NorahHead</td>\n","      <td>22.0</td>\n","      <td>27.8</td>\n","      <td>25.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SSW</td>\n","      <td>57.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>37.0</td>\n","      <td>91.0</td>\n","      <td>86.0</td>\n","      <td>1006.6</td>\n","      <td>1008.1</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>26.2</td>\n","      <td>23.1</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>3</td>\n","      <td>MountGambier</td>\n","      <td>12.0</td>\n","      <td>18.6</td>\n","      <td>2.2</td>\n","      <td>3.0</td>\n","      <td>7.8</td>\n","      <td>SW</td>\n","      <td>52.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>88.0</td>\n","      <td>62.0</td>\n","      <td>1020.2</td>\n","      <td>1019.9</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","      <td>14.8</td>\n","      <td>17.5</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>3</td>\n","      <td>MountGinini</td>\n","      <td>9.1</td>\n","      <td>13.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>41.0</td>\n","      <td>NaN</td>\n","      <td>...</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>10</td>\n","      <td>Wollongong</td>\n","      <td>13.1</td>\n","      <td>20.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>33.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>40.0</td>\n","      <td>51.0</td>\n","      <td>1021.3</td>\n","      <td>1019.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>16.8</td>\n","      <td>19.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>11</td>\n","      <td>Sale</td>\n","      <td>12.2</td>\n","      <td>20.0</td>\n","      <td>0.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>E</td>\n","      <td>33.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>92.0</td>\n","      <td>69.0</td>\n","      <td>1015.6</td>\n","      <td>1013.2</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","      <td>13.6</td>\n","      <td>19.0</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month      Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      1     NorahHead     22.0     27.8      25.2          NaN       NaN   \n","1      3  MountGambier     12.0     18.6       2.2          3.0       7.8   \n","2      3   MountGinini      9.1     13.3       NaN          NaN       NaN   \n","3     10    Wollongong     13.1     20.3       0.0          NaN       NaN   \n","4     11          Sale     12.2     20.0       0.4          NaN       NaN   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         SSW           57.0          S    ...             37.0         91.0   \n","1          SW           52.0         SW    ...             28.0         88.0   \n","2          NE           41.0        NaN    ...              NaN          NaN   \n","3          SW           33.0          W    ...             24.0         40.0   \n","4           E           33.0         SW    ...             19.0         92.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0         86.0       1006.6       1008.1       NaN       NaN     26.2   \n","1         62.0       1020.2       1019.9       8.0       7.0     14.8   \n","2          NaN          NaN          NaN       NaN       NaN      NaN   \n","3         51.0       1021.3       1019.5       NaN       NaN     16.8   \n","4         69.0       1015.6       1013.2       8.0       4.0     13.6   \n","\n","   Temp3pm  RainToday  \n","0     23.1        Yes  \n","1     17.5        Yes  \n","2      NaN        NaN  \n","3     19.6         No  \n","4     19.0         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":36}]},{"metadata":{"id":"nOW2T7JJZWFk","colab_type":"text"},"cell_type":"markdown","source":["## 3处理困难特征：地点"]},{"metadata":{"id":"wsa22vzYJGyY","colab_type":"code","outputId":"e2cb57a1-d98b-4170-a040-5c0cd232166a","executionInfo":{"status":"ok","timestamp":1546770899300,"user_tz":-480,"elapsed":1223,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"cell_type":"code","source":["Xtrain.loc[:,\"Location\"].value_counts().count()\n","#超过25个类别的分类型变量，都会被算法当成是连续型变量"],"execution_count":37,"outputs":[{"output_type":"execute_result","data":{"text/plain":["49"]},"metadata":{"tags":[]},"execution_count":37}]},{"metadata":{"id":"Yk4yALj5dPkz","colab_type":"code","colab":{}},"cell_type":"code","source":["citynames = Xtrain.loc[:,\"Location\"].unique()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"F9xPJTyQJGyZ","colab_type":"code","colab":{}},"cell_type":"code","source":["cityll = pd.read_csv(r\"cityll.csv\",index_col=0)\n","city_climate = pd.read_csv(r\"Cityclimate.csv\")"],"execution_count":0,"outputs":[]},{"metadata":{"id":"dhz6_FhiJGya","colab_type":"code","outputId":"e5ae4e1f-544b-41f1-8574-8d5141a6bd23","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546770913007,"user_tz":-480,"elapsed":732,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cityll.head() #每个城市对应的经纬度，这些城市是澳大利亚统计局做的那张地图上的城市"],"execution_count":40,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitude</th>\n","      <th>Longitude</th>\n","      <th>Latitudedir</th>\n","      <th>Longitudedir</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Adelaide</td>\n","      <td>34.9285°</td>\n","      <td>138.6007°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Albany</td>\n","      <td>35.0275°</td>\n","      <td>117.8840°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Albury</td>\n","      <td>36.0737°</td>\n","      <td>146.9135°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Wodonga</td>\n","      <td>36.1241°</td>\n","      <td>146.8818°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>AliceSprings</td>\n","      <td>23.6980°</td>\n","      <td>133.8807°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["           City  Latitude  Longitude Latitudedir Longitudedir\n","0      Adelaide  34.9285°  138.6007°          S,            E\n","1        Albany  35.0275°  117.8840°          S,            E\n","2        Albury  36.0737°  146.9135°          S,            E\n","3       Wodonga  36.1241°  146.8818°          S,            E\n","4  AliceSprings  23.6980°  133.8807°          S,            E"]},"metadata":{"tags":[]},"execution_count":40}]},{"metadata":{"id":"2o1m9kBzJGyd","colab_type":"code","outputId":"040f31a0-3301-412d-bcfd-83e8ec5ff269","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546770916033,"user_tz":-480,"elapsed":700,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["float(cityll.loc[0,\"Latitude\"][:-1])"],"execution_count":41,"outputs":[{"output_type":"execute_result","data":{"text/plain":["34.9285"]},"metadata":{"tags":[]},"execution_count":41}]},{"metadata":{"id":"sPfNbfgtJGyi","colab_type":"code","outputId":"71676e72-8ceb-442b-ce31-868154f89415","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546770919265,"user_tz":-480,"elapsed":719,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cityll.loc[:,\"Latitudedir\"].value_counts()"],"execution_count":42,"outputs":[{"output_type":"execute_result","data":{"text/plain":["S,    100\n","Name: Latitudedir, dtype: int64"]},"metadata":{"tags":[]},"execution_count":42}]},{"metadata":{"id":"mrdPifr0JGyk","colab_type":"code","outputId":"e2d87d1f-4033-4fdd-cf3d-09b6c99b569d","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546770923462,"user_tz":-480,"elapsed":892,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["city_climate.head() #澳大利亚统计局做的每个城市对应的气候"],"execution_count":43,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Climate</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Adelaide</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Albany</td>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Albury</td>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Wodonga</td>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>AliceSprings</td>\n","      <td>Hot dry summer, warm winter</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["           City                      Climate\n","0      Adelaide            Warm temperate   \n","1        Albany            Mild temperate   \n","2        Albury  Hot dry summer, cool winter\n","3       Wodonga  Hot dry summer, cool winter\n","4  AliceSprings  Hot dry summer, warm winter"]},"metadata":{"tags":[]},"execution_count":43}]},{"metadata":{"id":"Lu3MUvqMJGyl","colab_type":"code","colab":{}},"cell_type":"code","source":["#去掉度数符号\n","cityll[\"Latitudenum\"] = cityll[\"Latitude\"].apply(lambda x:float(x[:-1]))\n","cityll[\"Longitudenum\"] = cityll[\"Longitude\"].apply(lambda x:float(x[:-1]))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Dzx8sCCpJGyn","colab_type":"code","colab":{}},"cell_type":"code","source":["#观察一下所有的经纬度方向都是一致的，全部是南纬，东经，因为澳大利亚在南半球，东半球\n","#所以经纬度的方向我们可以舍弃了\n","citylld = cityll.iloc[:,[0,5,6]]"],"execution_count":0,"outputs":[]},{"metadata":{"id":"NTOUSPrZJGyp","colab_type":"code","outputId":"4a14530a-bed8-4a8c-bfd0-d9a10f5e790e","colab":{"base_uri":"https://localhost:8080/","height":1969},"executionInfo":{"status":"ok","timestamp":1546770937446,"user_tz":-480,"elapsed":801,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["citylld"],"execution_count":46,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitudenum</th>\n","      <th>Longitudenum</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Adelaide</td>\n","      <td>34.9285</td>\n","      <td>138.6007</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Albany</td>\n","      <td>35.0275</td>\n","      <td>117.8840</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Albury</td>\n","      <td>36.0737</td>\n","      <td>146.9135</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Wodonga</td>\n","      <td>36.1241</td>\n","      <td>146.8818</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>AliceSprings</td>\n","      <td>23.6980</td>\n","      <td>133.8807</td>\n","    </tr>\n","    <tr>\n","      <th>5</th>\n","      <td>Amata</td>\n","      <td>26.1509</td>\n","      <td>131.1467</td>\n","    </tr>\n","    <tr>\n","      <th>6</th>\n","      <td>Ballarat</td>\n","      <td>37.5622</td>\n","      <td>143.8503</td>\n","    </tr>\n","    <tr>\n","      <th>7</th>\n","      <td>Bathurst</td>\n","      <td>33.4193</td>\n","      <td>149.5775</td>\n","    </tr>\n","    <tr>\n","      <th>8</th>\n","      <td>Birdsville</td>\n","      <td>25.8989</td>\n","      <td>139.3517</td>\n","    </tr>\n","    <tr>\n","      <th>9</th>\n","      <td>Borroloola</td>\n","      <td>16.0703</td>\n","      <td>136.3072</td>\n","    </tr>\n","    <tr>\n","      <th>10</th>\n","      <td>Bourke</td>\n","      <td>30.0907</td>\n","      <td>145.9382</td>\n","    </tr>\n","    <tr>\n","      <th>11</th>\n","      <td>Brisbane</td>\n","      <td>27.4698</td>\n","      <td>153.0251</td>\n","    </tr>\n","    <tr>\n","      <th>12</th>\n","      <td>BrokenHill</td>\n","      <td>31.9539</td>\n","      <td>141.4539</td>\n","    </tr>\n","    <tr>\n","      <th>13</th>\n","      <td>Broome</td>\n","      <td>17.9614</td>\n","      <td>122.2359</td>\n","    </tr>\n","    <tr>\n","      <th>14</th>\n","      <td>Bunbury</td>\n","      <td>33.3256</td>\n","      <td>115.6396</td>\n","    </tr>\n","    <tr>\n","      <th>15</th>\n","      <td>Burketown</td>\n","      <td>17.8522</td>\n","      <td>139.6332</td>\n","    </tr>\n","    <tr>\n","      <th>16</th>\n","      <td>Burra</td>\n","      <td>33.6800</td>\n","      <td>138.9363</td>\n","    </tr>\n","    <tr>\n","      <th>17</th>\n","      <td>Cairns</td>\n","      <td>16.9186</td>\n","      <td>145.7781</td>\n","    </tr>\n","    <tr>\n","      <th>18</th>\n","      <td>Canberra</td>\n","      <td>35.2809</td>\n","      <td>149.1300</td>\n","    </tr>\n","    <tr>\n","      <th>19</th>\n","      <td>Carnarvon</td>\n","      <td>24.8840</td>\n","      <td>113.6610</td>\n","    </tr>\n","    <tr>\n","      <th>20</th>\n","      <td>Ceduna</td>\n","      <td>32.1306</td>\n","      <td>133.6817</td>\n","    </tr>\n","    <tr>\n","      <th>21</th>\n","      <td>Charleville</td>\n","      <td>26.4021</td>\n","      <td>146.2454</td>\n","    </tr>\n","    <tr>\n","      <th>22</th>\n","      <td>CooberPedy</td>\n","      <td>29.0139</td>\n","      <td>134.7533</td>\n","    </tr>\n","    <tr>\n","      <th>23</th>\n","      <td>Cooktown</td>\n","      <td>15.4758</td>\n","      <td>145.2471</td>\n","    </tr>\n","    <tr>\n","      <th>24</th>\n","      <td>CoffsHarbour</td>\n","      <td>30.2986</td>\n","      <td>153.1094</td>\n","    </tr>\n","    <tr>\n","      <th>25</th>\n","      <td>Dampier</td>\n","      <td>20.6582</td>\n","      <td>116.7151</td>\n","    </tr>\n","    <tr>\n","      <th>26</th>\n","      <td>Darwin</td>\n","      <td>12.4634</td>\n","      <td>130.8456</td>\n","    </tr>\n","    <tr>\n","      <th>27</th>\n","      <td>Derby</td>\n","      <td>17.3179</td>\n","      <td>123.6490</td>\n","    </tr>\n","    <tr>\n","      <th>28</th>\n","      <td>Devonport</td>\n","      <td>41.1771</td>\n","      <td>146.3452</td>\n","    </tr>\n","    <tr>\n","      <th>29</th>\n","      <td>Dubbo</td>\n","      <td>32.2315</td>\n","      <td>148.6330</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>70</th>\n","      <td>Perth</td>\n","      <td>31.9505</td>\n","      <td>115.8605</td>\n","    </tr>\n","    <tr>\n","      <th>71</th>\n","      <td>PerthAirport</td>\n","      <td>31.9440</td>\n","      <td>115.9680</td>\n","    </tr>\n","    <tr>\n","      <th>72</th>\n","      <td>PortHedland</td>\n","      <td>20.3107</td>\n","      <td>118.5878</td>\n","    </tr>\n","    <tr>\n","      <th>73</th>\n","      <td>PortLincoln</td>\n","      <td>34.7240</td>\n","      <td>135.8611</td>\n","    </tr>\n","    <tr>\n","      <th>74</th>\n","      <td>PortMacquarie</td>\n","      <td>31.4333</td>\n","      <td>152.9000</td>\n","    </tr>\n","    <tr>\n","      <th>75</th>\n","      <td>Renmark</td>\n","      <td>34.1743</td>\n","      <td>140.7443</td>\n","    </tr>\n","    <tr>\n","      <th>76</th>\n","      <td>Rockhampton</td>\n","      <td>23.3791</td>\n","      <td>150.5100</td>\n","    </tr>\n","    <tr>\n","      <th>77</th>\n","      <td>Shepparton</td>\n","      <td>36.3833</td>\n","      <td>145.4000</td>\n","    </tr>\n","    <tr>\n","      <th>78</th>\n","      <td>Southport</td>\n","      <td>27.9738</td>\n","      <td>153.4183</td>\n","    </tr>\n","    <tr>\n","      <th>79</th>\n","      <td>Strahan</td>\n","      <td>42.1500</td>\n","      <td>145.3167</td>\n","    </tr>\n","    <tr>\n","      <th>80</th>\n","      <td>Swansea</td>\n","      <td>33.0850</td>\n","      <td>151.6350</td>\n","    </tr>\n","    <tr>\n","      <th>81</th>\n","      <td>Sydney</td>\n","      <td>33.8688</td>\n","      <td>151.2093</td>\n","    </tr>\n","    <tr>\n","      <th>82</th>\n","      <td>SydneyAirport</td>\n","      <td>33.9399</td>\n","      <td>151.1753</td>\n","    </tr>\n","    <tr>\n","      <th>83</th>\n","      <td>Tamworth</td>\n","      <td>31.0927</td>\n","      <td>150.9320</td>\n","    </tr>\n","    <tr>\n","      <th>84</th>\n","      <td>Taroom</td>\n","      <td>25.6406</td>\n","      <td>149.7983</td>\n","    </tr>\n","    <tr>\n","      <th>85</th>\n","      <td>Telfer</td>\n","      <td>21.6924</td>\n","      <td>122.1478</td>\n","    </tr>\n","    <tr>\n","      <th>86</th>\n","      <td>TennantCreek</td>\n","      <td>19.6484</td>\n","      <td>134.1900</td>\n","    </tr>\n","    <tr>\n","      <th>87</th>\n","      <td>Thargomindah</td>\n","      <td>27.9944</td>\n","      <td>143.8229</td>\n","    </tr>\n","    <tr>\n","      <th>88</th>\n","      <td>Tibooburra</td>\n","      <td>29.4331</td>\n","      <td>142.0108</td>\n","    </tr>\n","    <tr>\n","      <th>89</th>\n","      <td>TimberCreek</td>\n","      <td>15.6432</td>\n","      <td>130.4666</td>\n","    </tr>\n","    <tr>\n","      <th>90</th>\n","      <td>Townsville</td>\n","      <td>19.2590</td>\n","      <td>146.8169</td>\n","    </tr>\n","    <tr>\n","      <th>91</th>\n","      <td>Warburton</td>\n","      <td>26.1353</td>\n","      <td>126.5783</td>\n","    </tr>\n","    <tr>\n","      <th>92</th>\n","      <td>Weipa</td>\n","      <td>12.6493</td>\n","      <td>141.8470</td>\n","    </tr>\n","    <tr>\n","      <th>93</th>\n","      <td>Whyalla</td>\n","      <td>33.0380</td>\n","      <td>137.5753</td>\n","    </tr>\n","    <tr>\n","      <th>94</th>\n","      <td>Wiluna</td>\n","      <td>26.5950</td>\n","      <td>120.2250</td>\n","    </tr>\n","    <tr>\n","      <th>95</th>\n","      <td>Wollongong</td>\n","      <td>34.4278</td>\n","      <td>150.8931</td>\n","    </tr>\n","    <tr>\n","      <th>96</th>\n","      <td>Wyndham</td>\n","      <td>15.4825</td>\n","      <td>128.1228</td>\n","    </tr>\n","    <tr>\n","      <th>97</th>\n","      <td>Yalgoo</td>\n","      <td>28.3445</td>\n","      <td>116.6851</td>\n","    </tr>\n","    <tr>\n","      <th>98</th>\n","      <td>Yulara</td>\n","      <td>25.2335</td>\n","      <td>130.9849</td>\n","    </tr>\n","    <tr>\n","      <th>99</th>\n","      <td>Uluru</td>\n","      <td>25.3444</td>\n","      <td>131.0369</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>100 rows × 3 columns</p>\n","</div>"],"text/plain":["             City  Latitudenum  Longitudenum\n","0        Adelaide      34.9285      138.6007\n","1          Albany      35.0275      117.8840\n","2          Albury      36.0737      146.9135\n","3         Wodonga      36.1241      146.8818\n","4    AliceSprings      23.6980      133.8807\n","5           Amata      26.1509      131.1467\n","6        Ballarat      37.5622      143.8503\n","7        Bathurst      33.4193      149.5775\n","8      Birdsville      25.8989      139.3517\n","9      Borroloola      16.0703      136.3072\n","10         Bourke      30.0907      145.9382\n","11       Brisbane      27.4698      153.0251\n","12     BrokenHill      31.9539      141.4539\n","13         Broome      17.9614      122.2359\n","14        Bunbury      33.3256      115.6396\n","15      Burketown      17.8522      139.6332\n","16          Burra      33.6800      138.9363\n","17         Cairns      16.9186      145.7781\n","18       Canberra      35.2809      149.1300\n","19      Carnarvon      24.8840      113.6610\n","20         Ceduna      32.1306      133.6817\n","21    Charleville      26.4021      146.2454\n","22     CooberPedy      29.0139      134.7533\n","23       Cooktown      15.4758      145.2471\n","24   CoffsHarbour      30.2986      153.1094\n","25        Dampier      20.6582      116.7151\n","26         Darwin      12.4634      130.8456\n","27          Derby      17.3179      123.6490\n","28      Devonport      41.1771      146.3452\n","29          Dubbo      32.2315      148.6330\n","..            ...          ...           ...\n","70          Perth      31.9505      115.8605\n","71   PerthAirport      31.9440      115.9680\n","72    PortHedland      20.3107      118.5878\n","73    PortLincoln      34.7240      135.8611\n","74  PortMacquarie      31.4333      152.9000\n","75        Renmark      34.1743      140.7443\n","76    Rockhampton      23.3791      150.5100\n","77     Shepparton      36.3833      145.4000\n","78      Southport      27.9738      153.4183\n","79        Strahan      42.1500      145.3167\n","80        Swansea      33.0850      151.6350\n","81         Sydney      33.8688      151.2093\n","82  SydneyAirport      33.9399      151.1753\n","83       Tamworth      31.0927      150.9320\n","84         Taroom      25.6406      149.7983\n","85         Telfer      21.6924      122.1478\n","86   TennantCreek      19.6484      134.1900\n","87   Thargomindah      27.9944      143.8229\n","88     Tibooburra      29.4331      142.0108\n","89    TimberCreek      15.6432      130.4666\n","90     Townsville      19.2590      146.8169\n","91      Warburton      26.1353      126.5783\n","92          Weipa      12.6493      141.8470\n","93        Whyalla      33.0380      137.5753\n","94         Wiluna      26.5950      120.2250\n","95     Wollongong      34.4278      150.8931\n","96        Wyndham      15.4825      128.1228\n","97         Yalgoo      28.3445      116.6851\n","98         Yulara      25.2335      130.9849\n","99          Uluru      25.3444      131.0369\n","\n","[100 rows x 3 columns]"]},"metadata":{"tags":[]},"execution_count":46}]},{"metadata":{"id":"muNCaFDjJGyt","colab_type":"code","outputId":"df8b2232-852b-475b-d395-7531d5250db2","colab":{"base_uri":"https://localhost:8080/","height":139},"executionInfo":{"status":"ok","timestamp":1546770946457,"user_tz":-480,"elapsed":788,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#将city_climate中的气候添加到我们的citylld中\n","citylld[\"climate\"] = city_climate.iloc[:,-1]"],"execution_count":47,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  \"\"\"Entry point for launching an IPython kernel.\n"],"name":"stderr"}]},{"metadata":{"id":"l9A9vCyCJGyv","colab_type":"code","outputId":"c9101cfc-39a5-4e36-c4ba-a22cee99e17d","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546770952964,"user_tz":-480,"elapsed":711,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["citylld.head()"],"execution_count":48,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitudenum</th>\n","      <th>Longitudenum</th>\n","      <th>climate</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Adelaide</td>\n","      <td>34.9285</td>\n","      <td>138.6007</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Albany</td>\n","      <td>35.0275</td>\n","      <td>117.8840</td>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Albury</td>\n","      <td>36.0737</td>\n","      <td>146.9135</td>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Wodonga</td>\n","      <td>36.1241</td>\n","      <td>146.8818</td>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>AliceSprings</td>\n","      <td>23.6980</td>\n","      <td>133.8807</td>\n","      <td>Hot dry summer, warm winter</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["           City  Latitudenum  Longitudenum                      climate\n","0      Adelaide      34.9285      138.6007            Warm temperate   \n","1        Albany      35.0275      117.8840            Mild temperate   \n","2        Albury      36.0737      146.9135  Hot dry summer, cool winter\n","3       Wodonga      36.1241      146.8818  Hot dry summer, cool winter\n","4  AliceSprings      23.6980      133.8807  Hot dry summer, warm winter"]},"metadata":{"tags":[]},"execution_count":48}]},{"metadata":{"id":"Q7WA5feWJGyz","colab_type":"code","outputId":"68b422d0-04e7-426e-dc0a-f1fa7c3ea903","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546770961878,"user_tz":-480,"elapsed":832,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["citylld.loc[:,\"climate\"].value_counts()"],"execution_count":49,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Hot dry summer, cool winter          24\n","Warm temperate                       18\n","Hot dry summer, warm winter          18\n","High humidity summer, warm winter    17\n","Cool temperate                        9\n","Mild temperate                        9\n","Warm humid summer, mild winter        5\n","Name: climate, dtype: int64"]},"metadata":{"tags":[]},"execution_count":49}]},{"metadata":{"id":"8GfSgRUOJGy3","colab_type":"code","colab":{}},"cell_type":"code","source":["samplecity = pd.read_csv(r\"samplecity.csv\",index_col=0)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Vuig8rI_JGy4","colab_type":"code","outputId":"f4b7aca0-a8b1-486a-d76d-1820feb3c946","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546770978531,"user_tz":-480,"elapsed":1086,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["samplecity.head()"],"execution_count":51,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitude</th>\n","      <th>Longitude</th>\n","      <th>Latitudedir</th>\n","      <th>Longitudedir</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Canberra</td>\n","      <td>35.2809°</td>\n","      <td>149.1300°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Sydney</td>\n","      <td>33.8688°</td>\n","      <td>151.2093°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Perth</td>\n","      <td>31.9505°</td>\n","      <td>115.8605°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Darwin</td>\n","      <td>12.4634°</td>\n","      <td>130.8456°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>Hobart</td>\n","      <td>42.8821°</td>\n","      <td>147.3272°</td>\n","      <td>S,</td>\n","      <td>E</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["       City  Latitude  Longitude Latitudedir Longitudedir\n","0  Canberra  35.2809°  149.1300°          S,            E\n","1    Sydney  33.8688°  151.2093°          S,            E\n","2     Perth  31.9505°  115.8605°          S,            E\n","3    Darwin  12.4634°  130.8456°          S,            E\n","4    Hobart  42.8821°  147.3272°          S,            E"]},"metadata":{"tags":[]},"execution_count":51}]},{"metadata":{"id":"rI1QuZKTJGy7","colab_type":"code","colab":{}},"cell_type":"code","source":["#我们对samplecity也执行同样的处理：去掉经纬度中度数的符号，并且舍弃我们的经纬度的方向\n","samplecity[\"Latitudenum\"] = samplecity[\"Latitude\"].apply(lambda x:float(x[:-1]))\n","samplecity[\"Longitudenum\"] = samplecity[\"Longitude\"].apply(lambda x:float(x[:-1]))\n","samplecityd = samplecity.iloc[:,[0,5,6]]"],"execution_count":0,"outputs":[]},{"metadata":{"id":"hbAuwOFwJGy9","colab_type":"code","outputId":"4476a00a-fffa-47d3-f813-dc43d4834e96","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546770987210,"user_tz":-480,"elapsed":777,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["samplecityd.head()"],"execution_count":53,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitudenum</th>\n","      <th>Longitudenum</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Canberra</td>\n","      <td>35.2809</td>\n","      <td>149.1300</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Sydney</td>\n","      <td>33.8688</td>\n","      <td>151.2093</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Perth</td>\n","      <td>31.9505</td>\n","      <td>115.8605</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Darwin</td>\n","      <td>12.4634</td>\n","      <td>130.8456</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>Hobart</td>\n","      <td>42.8821</td>\n","      <td>147.3272</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["       City  Latitudenum  Longitudenum\n","0  Canberra      35.2809      149.1300\n","1    Sydney      33.8688      151.2093\n","2     Perth      31.9505      115.8605\n","3    Darwin      12.4634      130.8456\n","4    Hobart      42.8821      147.3272"]},"metadata":{"tags":[]},"execution_count":53}]},{"metadata":{"id":"tHprFB-LJGzB","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":241},"outputId":"3cc97449-fdd5-4dfd-a4e2-5fa0732b549d","executionInfo":{"status":"ok","timestamp":1546770990580,"user_tz":-480,"elapsed":840,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#首先使用radians将角度转换成弧度\n","from math import radians, sin, cos, acos\n","citylld.loc[:,\"slat\"] = citylld.iloc[:,1].apply(lambda x : radians(x))\n","citylld.loc[:,\"slon\"] = citylld.iloc[:,2].apply(lambda x : radians(x))\n","samplecityd.loc[:,\"elat\"] = samplecityd.iloc[:,1].apply(lambda x : radians(x))\n","samplecityd.loc[:,\"elon\"] = samplecityd.iloc[:,2].apply(lambda x : radians(x))"],"execution_count":54,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:357: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[key] = _infer_fill_value(value)\n","/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:537: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[item] = s\n"],"name":"stderr"}]},{"metadata":{"id":"_8j668TaJGzE","colab_type":"code","outputId":"db580883-b0f2-4d30-b37b-8184be0fb77c","colab":{"base_uri":"https://localhost:8080/","height":275},"executionInfo":{"status":"ok","timestamp":1546770996596,"user_tz":-480,"elapsed":914,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["import sys\n","for i in range(samplecityd.shape[0]):\n","    slat = citylld.loc[:,\"slat\"]\n","    slon = citylld.loc[:,\"slon\"]\n","    elat = samplecityd.loc[i,\"elat\"]\n","    elon = samplecityd.loc[i,\"elon\"]\n","    dist = 6371.01 * np.arccos(np.sin(slat)*np.sin(elat) + \n","                          np.cos(slat)*np.cos(elat)*np.cos(slon.values - elon))\n","    city_index = np.argsort(dist)[0]\n","    #每次计算后，取距离最近的城市，然后将最近的城市和城市对应的气候都匹配到samplecityd中\n","    samplecityd.loc[i,\"closest_city\"] = citylld.loc[city_index,\"City\"]\n","    samplecityd.loc[i,\"climate\"] = citylld.loc[city_index,\"climate\"]"],"execution_count":55,"outputs":[{"output_type":"stream","text":["/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:357: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[key] = _infer_fill_value(value)\n","/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py:537: SettingWithCopyWarning: \n","A value is trying to be set on a copy of a slice from a DataFrame.\n","Try using .loc[row_indexer,col_indexer] = value instead\n","\n","See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n","  self.obj[item] = s\n","/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:8: RuntimeWarning: invalid value encountered in arccos\n","  \n"],"name":"stderr"}]},{"metadata":{"id":"b7UJL7NfJGzH","colab_type":"code","outputId":"8d2cecd2-e302-4d5b-c5ff-4402e20e3139","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546771000366,"user_tz":-480,"elapsed":850,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#查看最后的结果，需要检查城市匹配是否基本正确\n","samplecityd.head(5)"],"execution_count":56,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>Latitudenum</th>\n","      <th>Longitudenum</th>\n","      <th>elat</th>\n","      <th>elon</th>\n","      <th>closest_city</th>\n","      <th>climate</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Canberra</td>\n","      <td>35.2809</td>\n","      <td>149.1300</td>\n","      <td>0.615768</td>\n","      <td>2.602810</td>\n","      <td>Canberra</td>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Sydney</td>\n","      <td>33.8688</td>\n","      <td>151.2093</td>\n","      <td>0.591122</td>\n","      <td>2.639100</td>\n","      <td>Sydney</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Perth</td>\n","      <td>31.9505</td>\n","      <td>115.8605</td>\n","      <td>0.557641</td>\n","      <td>2.022147</td>\n","      <td>Perth</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Darwin</td>\n","      <td>12.4634</td>\n","      <td>130.8456</td>\n","      <td>0.217527</td>\n","      <td>2.283687</td>\n","      <td>Darwin</td>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>Hobart</td>\n","      <td>42.8821</td>\n","      <td>147.3272</td>\n","      <td>0.748434</td>\n","      <td>2.571345</td>\n","      <td>Hobart</td>\n","      <td>Cool temperate</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["       City  Latitudenum  Longitudenum      elat      elon closest_city  \\\n","0  Canberra      35.2809      149.1300  0.615768  2.602810     Canberra   \n","1    Sydney      33.8688      151.2093  0.591122  2.639100       Sydney   \n","2     Perth      31.9505      115.8605  0.557641  2.022147        Perth   \n","3    Darwin      12.4634      130.8456  0.217527  2.283687       Darwin   \n","4    Hobart      42.8821      147.3272  0.748434  2.571345       Hobart   \n","\n","                             climate  \n","0                  Cool temperate     \n","1                  Warm temperate     \n","2                  Warm temperate     \n","3  High humidity summer, warm winter  \n","4                  Cool temperate     "]},"metadata":{"tags":[]},"execution_count":56}]},{"metadata":{"id":"7f9xmDdpJGzK","colab_type":"code","outputId":"eb37f2a4-ba09-408f-c82c-55aa0cd20db9","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546771011385,"user_tz":-480,"elapsed":727,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#查看气候的分布\n","samplecityd[\"climate\"].value_counts()"],"execution_count":57,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Warm temperate                       15\n","Mild temperate                       10\n","Cool temperate                        9\n","Hot dry summer, cool winter           6\n","High humidity summer, warm winter     4\n","Hot dry summer, warm winter           3\n","Warm humid summer, mild winter        2\n","Name: climate, dtype: int64"]},"metadata":{"tags":[]},"execution_count":57}]},{"metadata":{"id":"Y_2IutuYJGzO","colab_type":"code","colab":{}},"cell_type":"code","source":["#确认无误后，取出样本城市所对应的气候，并保存\n","locafinal = samplecityd.iloc[:,[0,-1]]"],"execution_count":0,"outputs":[]},{"metadata":{"id":"KdkHg-cKJGzQ","colab_type":"code","outputId":"4c237b5a-528f-4ebf-93a8-0d2a9dc2fd91","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546771017254,"user_tz":-480,"elapsed":1167,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["locafinal.head()"],"execution_count":59,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>City</th>\n","      <th>climate</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Canberra</td>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>Sydney</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>Perth</td>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>Darwin</td>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>Hobart</td>\n","      <td>Cool temperate</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["       City                            climate\n","0  Canberra                  Cool temperate   \n","1    Sydney                  Warm temperate   \n","2     Perth                  Warm temperate   \n","3    Darwin  High humidity summer, warm winter\n","4    Hobart                  Cool temperate   "]},"metadata":{"tags":[]},"execution_count":59}]},{"metadata":{"id":"2pxh-9OdJGzS","colab_type":"code","colab":{}},"cell_type":"code","source":["locafinal.columns = [\"Location\",\"Climate\"]"],"execution_count":0,"outputs":[]},{"metadata":{"id":"teL9PvlzJGzT","colab_type":"code","colab":{}},"cell_type":"code","source":["#在这里设定locafinal的索引为地点，是为了之后进行map的匹配\n","locafinal = locafinal.set_index(keys=\"Location\")"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Wz8qYWO5JGzX","colab_type":"code","outputId":"3878d454-4337-4992-a258-d111573aa033","colab":{"base_uri":"https://localhost:8080/","height":1599},"executionInfo":{"status":"ok","timestamp":1546771030998,"user_tz":-480,"elapsed":729,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["locafinal"],"execution_count":62,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Climate</th>\n","    </tr>\n","    <tr>\n","      <th>Location</th>\n","      <th></th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>Canberra</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Sydney</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Perth</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Darwin</th>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>Hobart</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Brisbane</th>\n","      <td>Warm humid summer, mild winter</td>\n","    </tr>\n","    <tr>\n","      <th>Adelaide</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Bendigo</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Townsville</th>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>AliceSprings</th>\n","      <td>Hot dry summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>MountGambier</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Launceston</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Ballarat</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Albany</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Albury</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>PerthAirport</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>MelbourneAirport</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Mildura</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>SydneyAirport</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Nuriootpa</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Sale</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Watsonia</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>Tuggeranong</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Portland</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Woomera</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Cairns</th>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>Cobar</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>Wollongong</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>GoldCoast</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>WaggaWagga</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>NorfolkIsland</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Penrith</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>SalmonGums</th>\n","      <td>Hot dry summer, cool winter</td>\n","    </tr>\n","    <tr>\n","      <th>Newcastle</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>CoffsHarbour</th>\n","      <td>Warm humid summer, mild winter</td>\n","    </tr>\n","    <tr>\n","      <th>Witchcliffe</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Richmond</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Dartmoor</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>NorahHead</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>BadgerysCreek</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>MountGinini</th>\n","      <td>Cool temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Moree</th>\n","      <td>Hot dry summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>Walpole</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>PearceRAAF</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Williamtown</th>\n","      <td>Warm temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Melbourne</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Nhil</th>\n","      <td>Mild temperate</td>\n","    </tr>\n","    <tr>\n","      <th>Katherine</th>\n","      <td>High humidity summer, warm winter</td>\n","    </tr>\n","    <tr>\n","      <th>Uluru</th>\n","      <td>Hot dry summer, warm winter</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["                                            Climate\n","Location                                           \n","Canberra                          Cool temperate   \n","Sydney                            Warm temperate   \n","Perth                             Warm temperate   \n","Darwin            High humidity summer, warm winter\n","Hobart                            Cool temperate   \n","Brisbane             Warm humid summer, mild winter\n","Adelaide                          Warm temperate   \n","Bendigo                           Cool temperate   \n","Townsville        High humidity summer, warm winter\n","AliceSprings            Hot dry summer, warm winter\n","MountGambier                      Mild temperate   \n","Launceston                        Cool temperate   \n","Ballarat                          Cool temperate   \n","Albany                            Mild temperate   \n","Albury                  Hot dry summer, cool winter\n","PerthAirport                      Warm temperate   \n","MelbourneAirport                  Mild temperate   \n","Mildura                 Hot dry summer, cool winter\n","SydneyAirport                     Warm temperate   \n","Nuriootpa                         Warm temperate   \n","Sale                              Mild temperate   \n","Watsonia                Hot dry summer, cool winter\n","Tuggeranong                       Cool temperate   \n","Portland                          Mild temperate   \n","Woomera                           Warm temperate   \n","Cairns            High humidity summer, warm winter\n","Cobar                   Hot dry summer, cool winter\n","Wollongong                        Warm temperate   \n","GoldCoast                         Cool temperate   \n","WaggaWagga              Hot dry summer, cool winter\n","NorfolkIsland                     Warm temperate   \n","Penrith                           Warm temperate   \n","SalmonGums              Hot dry summer, cool winter\n","Newcastle                         Warm temperate   \n","CoffsHarbour         Warm humid summer, mild winter\n","Witchcliffe                       Warm temperate   \n","Richmond                          Mild temperate   \n","Dartmoor                          Mild temperate   \n","NorahHead                         Cool temperate   \n","BadgerysCreek                     Warm temperate   \n","MountGinini                       Cool temperate   \n","Moree                   Hot dry summer, warm winter\n","Walpole                           Mild temperate   \n","PearceRAAF                        Warm temperate   \n","Williamtown                       Warm temperate   \n","Melbourne                         Mild temperate   \n","Nhil                              Mild temperate   \n","Katherine         High humidity summer, warm winter\n","Uluru                   Hot dry summer, warm winter"]},"metadata":{"tags":[]},"execution_count":62}]},{"metadata":{"id":"jWkoyvewJGzZ","colab_type":"code","colab":{}},"cell_type":"code","source":["locafinal.to_csv(r\"samplelocation.csv\")"],"execution_count":0,"outputs":[]},{"metadata":{"id":"2khNVuzsJGzc","colab_type":"code","outputId":"0a813378-25da-4aad-b3a3-3c8f4c1ccbb0","colab":{"base_uri":"https://localhost:8080/","height":253},"executionInfo":{"status":"ok","timestamp":1546771056579,"user_tz":-480,"elapsed":694,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#是否还记得训练集长什么样呢？\n","Xtrain.head()"],"execution_count":64,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>Katherine</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>Tuggeranong</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>Albany</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>Sale</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>Mildura</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month     Location  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      8    Katherine     17.5     36.0       0.0          8.8       NaN   \n","1     12  Tuggeranong      9.5     25.0       0.0          NaN       NaN   \n","2      4       Albany     13.0     22.6       0.0          3.8      10.4   \n","3     11         Sale     13.9     29.8       0.0          5.8       5.1   \n","4      4      Mildura      6.0     23.5       0.0          2.8       8.6   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         ESE           26.0        NNW    ...             15.0         57.0   \n","1         NNW           33.0         NE    ...             17.0         59.0   \n","2         NaN            NaN         NE    ...             31.0         79.0   \n","3           S           37.0          N    ...             28.0         82.0   \n","4         NNE           24.0          E    ...             15.0         58.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0          NaN       1016.8       1012.2       0.0       NaN     27.5   \n","1         31.0       1020.4       1017.5       NaN       NaN     14.6   \n","2         68.0       1020.3       1015.7       1.0       3.0     17.5   \n","3         44.0       1012.5       1005.9       6.0       6.0     18.5   \n","4         35.0       1019.8       1014.1       2.0       4.0     12.4   \n","\n","   Temp3pm  RainToday  \n","0      NaN         No  \n","1     23.6         No  \n","2     20.8         No  \n","3     27.5         No  \n","4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":64}]},{"metadata":{"id":"oKtVCOarJGzd","colab_type":"code","colab":{}},"cell_type":"code","source":["#将location中的内容替换，并且确保匹配进入的气候字符串中不含有逗号，气候两边不含有空格\n","#我们使用re这个模块来消除逗号\n","#re.sub(希望替换的值，希望被替换成的值，要操作的字符串) #去掉逗号\n","#x.strip()是去掉空格的函数\n","#把location替换成气候的是我们的map的映射\n","import re"],"execution_count":0,"outputs":[]},{"metadata":{"id":"zPRnnT5BJGzf","colab_type":"code","colab":{}},"cell_type":"code","source":["#气象站的名字替换成了对应的城市对应的气候\n","Xtrain[\"Location\"] = Xtrain[\"Location\"].map(locafinal.iloc[:,0])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"QZ3iiv1nJGzg","colab_type":"code","outputId":"d0550bed-2e16-4c00-d874-9b09f0df24db","colab":{"base_uri":"https://localhost:8080/","height":423},"executionInfo":{"status":"ok","timestamp":1546771067783,"user_tz":-480,"elapsed":897,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":67,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Location</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>High humidity summer, warm winter</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>Cool temperate</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>Mild temperate</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>Mild temperate</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>Hot dry summer, cool winter</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month                           Location  MinTemp  MaxTemp  Rainfall  \\\n","0      8  High humidity summer, warm winter     17.5     36.0       0.0   \n","1     12                  Cool temperate         9.5     25.0       0.0   \n","2      4                  Mild temperate        13.0     22.6       0.0   \n","3     11                  Mild temperate        13.9     29.8       0.0   \n","4      4        Hot dry summer, cool winter      6.0     23.5       0.0   \n","\n","   Evaporation  Sunshine WindGustDir  WindGustSpeed WindDir9am    ...      \\\n","0          8.8       NaN         ESE           26.0        NNW    ...       \n","1          NaN       NaN         NNW           33.0         NE    ...       \n","2          3.8      10.4         NaN            NaN         NE    ...       \n","3          5.8       5.1           S           37.0          N    ...       \n","4          2.8       8.6         NNE           24.0          E    ...       \n","\n","  WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  \\\n","0         15.0         57.0          NaN       1016.8       1012.2       0.0   \n","1         17.0         59.0         31.0       1020.4       1017.5       NaN   \n","2         31.0         79.0         68.0       1020.3       1015.7       1.0   \n","3         28.0         82.0         44.0       1012.5       1005.9       6.0   \n","4         15.0         58.0         35.0       1019.8       1014.1       2.0   \n","\n","   Cloud3pm  Temp9am  Temp3pm  RainToday  \n","0       NaN     27.5      NaN         No  \n","1       NaN     14.6     23.6         No  \n","2       3.0     17.5     20.8         No  \n","3       6.0     18.5     27.5         No  \n","4       4.0     12.4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":67}]},{"metadata":{"id":"kwi9DrtwJGzk","colab_type":"code","colab":{}},"cell_type":"code","source":["#城市的气候中所含的逗号和空格都去掉\n","Xtrain[\"Location\"] = Xtrain[\"Location\"].apply(lambda x:re.sub(\",\",\"\",x.strip()))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"cpIPaziQJGzm","colab_type":"code","colab":{}},"cell_type":"code","source":["Xtest[\"Location\"] = Xtest[\"Location\"].map(locafinal.iloc[:,0]).apply(lambda x:re.sub(\",\",\"\",x.strip()))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"yuXBEaIbJGzn","colab_type":"code","colab":{}},"cell_type":"code","source":["#修改特征内容之后，我们使用新列名“Climate”来替换之前的列名“Location”\n","#注意这个命令一旦执行之后，就再没有列\"Location\"了，使用索引时要特别注意\n","Xtrain = Xtrain.rename(columns={\"Location\":\"Climate\"})\n","Xtest = Xtest.rename(columns={\"Location\":\"Climate\"})"],"execution_count":0,"outputs":[]},{"metadata":{"id":"pSFevrtHJGzo","colab_type":"code","outputId":"797d7c9d-d0e7-48e5-8302-421e90ce0bc4","colab":{"base_uri":"https://localhost:8080/","height":423},"executionInfo":{"status":"ok","timestamp":1546771179469,"user_tz":-480,"elapsed":817,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":85,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>High humidity summer warm winter</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>Cool temperate</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>Mild temperate</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>W</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>Mild temperate</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>Hot dry summer cool winter</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month                           Climate  MinTemp  MaxTemp  Rainfall  \\\n","0      8  High humidity summer warm winter     17.5     36.0       0.0   \n","1     12                    Cool temperate      9.5     25.0       0.0   \n","2      4                    Mild temperate     13.0     22.6       0.0   \n","3     11                    Mild temperate     13.9     29.8       0.0   \n","4      4        Hot dry summer cool winter      6.0     23.5       0.0   \n","\n","   Evaporation  Sunshine WindGustDir  WindGustSpeed WindDir9am    ...      \\\n","0          8.8       NaN         ESE           26.0        NNW    ...       \n","1          NaN       NaN         NNW           33.0         NE    ...       \n","2          3.8      10.4           W            NaN         NE    ...       \n","3          5.8       5.1           S           37.0          N    ...       \n","4          2.8       8.6         NNE           24.0          E    ...       \n","\n","  WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  \\\n","0         15.0         57.0          NaN       1016.8       1012.2       0.0   \n","1         17.0         59.0         31.0       1020.4       1017.5       7.0   \n","2         31.0         79.0         68.0       1020.3       1015.7       1.0   \n","3         28.0         82.0         44.0       1012.5       1005.9       6.0   \n","4         15.0         58.0         35.0       1019.8       1014.1       2.0   \n","\n","   Cloud3pm  Temp9am  Temp3pm  RainToday  \n","0       7.0     27.5      NaN         No  \n","1       7.0     14.6     23.6         No  \n","2       3.0     17.5     20.8         No  \n","3       6.0     18.5     27.5         No  \n","4       4.0     12.4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":85}]},{"metadata":{"id":"NJt3MXT2JGzr","colab_type":"code","outputId":"5315f6e6-791e-4a03-ca34-d30a152a9b0a","colab":{"base_uri":"https://localhost:8080/","height":338},"executionInfo":{"status":"ok","timestamp":1546771183805,"user_tz":-480,"elapsed":799,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.head()"],"execution_count":86,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>1</td>\n","      <td>Cool temperate</td>\n","      <td>22.0</td>\n","      <td>27.8</td>\n","      <td>25.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SSW</td>\n","      <td>57.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>37.0</td>\n","      <td>91.0</td>\n","      <td>86.0</td>\n","      <td>1006.6</td>\n","      <td>1008.1</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>26.2</td>\n","      <td>23.1</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>3</td>\n","      <td>Mild temperate</td>\n","      <td>12.0</td>\n","      <td>18.6</td>\n","      <td>2.2</td>\n","      <td>3.0</td>\n","      <td>7.8</td>\n","      <td>SW</td>\n","      <td>52.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>88.0</td>\n","      <td>62.0</td>\n","      <td>1020.2</td>\n","      <td>1019.9</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","      <td>14.8</td>\n","      <td>17.5</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>3</td>\n","      <td>Cool temperate</td>\n","      <td>9.1</td>\n","      <td>13.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>41.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>10</td>\n","      <td>Warm temperate</td>\n","      <td>13.1</td>\n","      <td>20.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>33.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>40.0</td>\n","      <td>51.0</td>\n","      <td>1021.3</td>\n","      <td>1019.5</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>16.8</td>\n","      <td>19.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>11</td>\n","      <td>Mild temperate</td>\n","      <td>12.2</td>\n","      <td>20.0</td>\n","      <td>0.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>E</td>\n","      <td>33.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>92.0</td>\n","      <td>69.0</td>\n","      <td>1015.6</td>\n","      <td>1013.2</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","      <td>13.6</td>\n","      <td>19.0</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month         Climate  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      1  Cool temperate     22.0     27.8      25.2          NaN       NaN   \n","1      3  Mild temperate     12.0     18.6       2.2          3.0       7.8   \n","2      3  Cool temperate      9.1     13.3       NaN          NaN       NaN   \n","3     10  Warm temperate     13.1     20.3       0.0          NaN       NaN   \n","4     11  Mild temperate     12.2     20.0       0.4          NaN       NaN   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         SSW           57.0          S    ...             37.0         91.0   \n","1          SW           52.0         SW    ...             28.0         88.0   \n","2          NE           41.0          N    ...              NaN          NaN   \n","3          SW           33.0          W    ...             24.0         40.0   \n","4           E           33.0         SW    ...             19.0         92.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0         86.0       1006.6       1008.1       7.0       7.0     26.2   \n","1         62.0       1020.2       1019.9       8.0       7.0     14.8   \n","2          NaN          NaN          NaN       7.0       7.0      NaN   \n","3         51.0       1021.3       1019.5       7.0       7.0     16.8   \n","4         69.0       1015.6       1013.2       8.0       4.0     13.6   \n","\n","   Temp3pm  RainToday  \n","0     23.1        Yes  \n","1     17.5        Yes  \n","2      NaN         No  \n","3     19.6         No  \n","4     19.0         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":86}]},{"metadata":{"id":"CyybSx3-vgs2","colab_type":"text"},"cell_type":"markdown","source":["## 4 处理分类型变量：缺失值\n"]},{"metadata":{"id":"nytVBm2TJGzz","colab_type":"code","outputId":"aa856877-d029-4d03-b916-599d9c1f7dce","colab":{"base_uri":"https://localhost:8080/","height":408},"executionInfo":{"status":"ok","timestamp":1546771186819,"user_tz":-480,"elapsed":858,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#查看缺失值的缺失情况\n","Xtrain.isnull().mean()"],"execution_count":87,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Month            0.000000\n","Climate          0.000000\n","MinTemp          0.004000\n","MaxTemp          0.003143\n","Rainfall         0.009429\n","Evaporation      0.433429\n","Sunshine         0.488571\n","WindGustDir      0.000000\n","WindGustSpeed    0.067714\n","WindDir9am       0.000000\n","WindDir3pm       0.000000\n","WindSpeed9am     0.009714\n","WindSpeed3pm     0.018000\n","Humidity9am      0.011714\n","Humidity3pm      0.026286\n","Pressure9am      0.098857\n","Pressure3pm      0.098857\n","Cloud9am         0.000000\n","Cloud3pm         0.000000\n","Temp9am          0.005429\n","Temp3pm          0.019714\n","RainToday        0.000000\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":87}]},{"metadata":{"id":"iKrhIawMJGz3","colab_type":"code","outputId":"e4fd922e-862f-4b39-d707-44e521e41db0","colab":{"base_uri":"https://localhost:8080/","height":476},"executionInfo":{"status":"ok","timestamp":1546771189971,"user_tz":-480,"elapsed":759,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.info()"],"execution_count":88,"outputs":[{"output_type":"stream","text":["<class 'pandas.core.frame.DataFrame'>\n","RangeIndex: 3500 entries, 0 to 3499\n","Data columns (total 22 columns):\n","Month            3500 non-null int64\n","Climate          3500 non-null object\n","MinTemp          3486 non-null float64\n","MaxTemp          3489 non-null float64\n","Rainfall         3467 non-null float64\n","Evaporation      1983 non-null float64\n","Sunshine         1790 non-null float64\n","WindGustDir      3500 non-null object\n","WindGustSpeed    3263 non-null float64\n","WindDir9am       3500 non-null object\n","WindDir3pm       3500 non-null object\n","WindSpeed9am     3466 non-null float64\n","WindSpeed3pm     3437 non-null float64\n","Humidity9am      3459 non-null float64\n","Humidity3pm      3408 non-null float64\n","Pressure9am      3154 non-null float64\n","Pressure3pm      3154 non-null float64\n","Cloud9am         3500 non-null float64\n","Cloud3pm         3500 non-null float64\n","Temp9am          3481 non-null float64\n","Temp3pm          3431 non-null float64\n","RainToday        3500 non-null object\n","dtypes: float64(16), int64(1), object(5)\n","memory usage: 601.6+ KB\n"],"name":"stdout"}]},{"metadata":{"id":"LUqpaPBdJGz6","colab_type":"code","outputId":"62ce8573-4c7e-4b45-96fb-7be805bd89de","colab":{"base_uri":"https://localhost:8080/","height":408},"executionInfo":{"status":"ok","timestamp":1546771192853,"user_tz":-480,"elapsed":921,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.dtypes == \"object\""],"execution_count":89,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Month            False\n","Climate           True\n","MinTemp          False\n","MaxTemp          False\n","Rainfall         False\n","Evaporation      False\n","Sunshine         False\n","WindGustDir       True\n","WindGustSpeed    False\n","WindDir9am        True\n","WindDir3pm        True\n","WindSpeed9am     False\n","WindSpeed3pm     False\n","Humidity9am      False\n","Humidity3pm      False\n","Pressure9am      False\n","Pressure3pm      False\n","Cloud9am         False\n","Cloud3pm         False\n","Temp9am          False\n","Temp3pm          False\n","RainToday         True\n","dtype: bool"]},"metadata":{"tags":[]},"execution_count":89}]},{"metadata":{"id":"tbiGz84RJG0A","colab_type":"code","colab":{}},"cell_type":"code","source":["#首先找出，分类型特征都有哪些\n","cate = Xtrain.columns[Xtrain.dtypes == \"object\"].tolist()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"VFtxJSc7JG0B","colab_type":"code","outputId":"4cd59d8f-c4e8-47c8-b9cf-2af49fe596b0","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546771196964,"user_tz":-480,"elapsed":823,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cate"],"execution_count":91,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Climate', 'WindGustDir', 'WindDir9am', 'WindDir3pm', 'RainToday']"]},"metadata":{"tags":[]},"execution_count":91}]},{"metadata":{"id":"ONdD6glUJG0C","colab_type":"code","colab":{}},"cell_type":"code","source":["#除了特征类型为\"object\"的特征们，还有虽然用数字表示，但是本质为分类型特征的云层遮蔽程度\n","cloud = [\"Cloud9am\",\"Cloud3pm\"]\n","cate = cate + cloud"],"execution_count":0,"outputs":[]},{"metadata":{"id":"T7r7nD3eJG0G","colab_type":"code","outputId":"14355194-4bd4-4163-f4bd-5773565428a4","colab":{"base_uri":"https://localhost:8080/","height":136},"executionInfo":{"status":"ok","timestamp":1546771201247,"user_tz":-480,"elapsed":787,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cate"],"execution_count":93,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Climate',\n"," 'WindGustDir',\n"," 'WindDir9am',\n"," 'WindDir3pm',\n"," 'RainToday',\n"," 'Cloud9am',\n"," 'Cloud3pm']"]},"metadata":{"tags":[]},"execution_count":93}]},{"metadata":{"id":"T9gV0oqGJG0I","colab_type":"code","outputId":"ed0c93f5-b23a-4b40-f821-775ceb6bb8cc","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546771203266,"user_tz":-480,"elapsed":865,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#对于分类型特征，我们使用众数来进行填补\n","from sklearn.impute import SimpleImputer #0.20, conda, pip\n","\n","si = SimpleImputer(missing_values=np.nan,strategy=\"most_frequent\")\n","#注意，我们使用训练集数据来训练我们的填补器，本质是在生成训练集中的众数\n","si.fit(Xtrain.loc[:,cate])"],"execution_count":94,"outputs":[{"output_type":"execute_result","data":{"text/plain":["SimpleImputer(copy=True, fill_value=None, missing_values=nan,\n","       strategy='most_frequent', verbose=0)"]},"metadata":{"tags":[]},"execution_count":94}]},{"metadata":{"id":"b1zMxb6ZJG0I","colab_type":"code","colab":{}},"cell_type":"code","source":["#然后我们用训练集中的众数来同时填补训练集和测试集\n","Xtrain.loc[:,cate] = si.transform(Xtrain.loc[:,cate])\n","Xtest.loc[:,cate] = si.transform(Xtest.loc[:,cate])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"91FqXGUJJG0J","colab_type":"code","outputId":"0a8a0b66-969d-43c4-ffba-64709766030a","colab":{"base_uri":"https://localhost:8080/","height":423},"executionInfo":{"status":"ok","timestamp":1546771207278,"user_tz":-480,"elapsed":971,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":96,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>High humidity summer warm winter</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>ESE</td>\n","      <td>26.0</td>\n","      <td>NNW</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>Cool temperate</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NNW</td>\n","      <td>33.0</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>Mild temperate</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>W</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>Mild temperate</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>S</td>\n","      <td>37.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>Hot dry summer cool winter</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>NNE</td>\n","      <td>24.0</td>\n","      <td>E</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month                           Climate  MinTemp  MaxTemp  Rainfall  \\\n","0      8  High humidity summer warm winter     17.5     36.0       0.0   \n","1     12                    Cool temperate      9.5     25.0       0.0   \n","2      4                    Mild temperate     13.0     22.6       0.0   \n","3     11                    Mild temperate     13.9     29.8       0.0   \n","4      4        Hot dry summer cool winter      6.0     23.5       0.0   \n","\n","   Evaporation  Sunshine WindGustDir  WindGustSpeed WindDir9am    ...      \\\n","0          8.8       NaN         ESE           26.0        NNW    ...       \n","1          NaN       NaN         NNW           33.0         NE    ...       \n","2          3.8      10.4           W            NaN         NE    ...       \n","3          5.8       5.1           S           37.0          N    ...       \n","4          2.8       8.6         NNE           24.0          E    ...       \n","\n","  WindSpeed3pm  Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  \\\n","0         15.0         57.0          NaN       1016.8       1012.2       0.0   \n","1         17.0         59.0         31.0       1020.4       1017.5       7.0   \n","2         31.0         79.0         68.0       1020.3       1015.7       1.0   \n","3         28.0         82.0         44.0       1012.5       1005.9       6.0   \n","4         15.0         58.0         35.0       1019.8       1014.1       2.0   \n","\n","   Cloud3pm  Temp9am  Temp3pm  RainToday  \n","0       7.0     27.5      NaN         No  \n","1       7.0     14.6     23.6         No  \n","2       3.0     17.5     20.8         No  \n","3       6.0     18.5     27.5         No  \n","4       4.0     12.4     22.4         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":96}]},{"metadata":{"id":"pfIYbHe1JG0K","colab_type":"code","outputId":"915dde05-6c8e-4cc5-f2d2-6fc278c3a1a9","colab":{"base_uri":"https://localhost:8080/","height":338},"executionInfo":{"status":"ok","timestamp":1546771213904,"user_tz":-480,"elapsed":737,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.head()"],"execution_count":97,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>1</td>\n","      <td>Cool temperate</td>\n","      <td>22.0</td>\n","      <td>27.8</td>\n","      <td>25.2</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SSW</td>\n","      <td>57.0</td>\n","      <td>S</td>\n","      <td>...</td>\n","      <td>37.0</td>\n","      <td>91.0</td>\n","      <td>86.0</td>\n","      <td>1006.6</td>\n","      <td>1008.1</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>26.2</td>\n","      <td>23.1</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>3</td>\n","      <td>Mild temperate</td>\n","      <td>12.0</td>\n","      <td>18.6</td>\n","      <td>2.2</td>\n","      <td>3.0</td>\n","      <td>7.8</td>\n","      <td>SW</td>\n","      <td>52.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>88.0</td>\n","      <td>62.0</td>\n","      <td>1020.2</td>\n","      <td>1019.9</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","      <td>14.8</td>\n","      <td>17.5</td>\n","      <td>Yes</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>3</td>\n","      <td>Cool temperate</td>\n","      <td>9.1</td>\n","      <td>13.3</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NE</td>\n","      <td>41.0</td>\n","      <td>N</td>\n","      <td>...</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>10</td>\n","      <td>Warm temperate</td>\n","      <td>13.1</td>\n","      <td>20.3</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>SW</td>\n","      <td>33.0</td>\n","      <td>W</td>\n","      <td>...</td>\n","      <td>24.0</td>\n","      <td>40.0</td>\n","      <td>51.0</td>\n","      <td>1021.3</td>\n","      <td>1019.5</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>16.8</td>\n","      <td>19.6</td>\n","      <td>No</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>11</td>\n","      <td>Mild temperate</td>\n","      <td>12.2</td>\n","      <td>20.0</td>\n","      <td>0.4</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>E</td>\n","      <td>33.0</td>\n","      <td>SW</td>\n","      <td>...</td>\n","      <td>19.0</td>\n","      <td>92.0</td>\n","      <td>69.0</td>\n","      <td>1015.6</td>\n","      <td>1013.2</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","      <td>13.6</td>\n","      <td>19.0</td>\n","      <td>No</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month         Climate  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      1  Cool temperate     22.0     27.8      25.2          NaN       NaN   \n","1      3  Mild temperate     12.0     18.6       2.2          3.0       7.8   \n","2      3  Cool temperate      9.1     13.3       NaN          NaN       NaN   \n","3     10  Warm temperate     13.1     20.3       0.0          NaN       NaN   \n","4     11  Mild temperate     12.2     20.0       0.4          NaN       NaN   \n","\n","  WindGustDir  WindGustSpeed WindDir9am    ...     WindSpeed3pm  Humidity9am  \\\n","0         SSW           57.0          S    ...             37.0         91.0   \n","1          SW           52.0         SW    ...             28.0         88.0   \n","2          NE           41.0          N    ...              NaN          NaN   \n","3          SW           33.0          W    ...             24.0         40.0   \n","4           E           33.0         SW    ...             19.0         92.0   \n","\n","   Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  Temp9am  \\\n","0         86.0       1006.6       1008.1       7.0       7.0     26.2   \n","1         62.0       1020.2       1019.9       8.0       7.0     14.8   \n","2          NaN          NaN          NaN       7.0       7.0      NaN   \n","3         51.0       1021.3       1019.5       7.0       7.0     16.8   \n","4         69.0       1015.6       1013.2       8.0       4.0     13.6   \n","\n","   Temp3pm  RainToday  \n","0     23.1        Yes  \n","1     17.5        Yes  \n","2      NaN         No  \n","3     19.6         No  \n","4     19.0         No  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":97}]},{"metadata":{"id":"H_bnx0yuJG0M","colab_type":"code","outputId":"a3bc3333-ac6f-4b70-8550-a8b567748404","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546771217055,"user_tz":-480,"elapsed":802,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#查看分类型特征是否依然存在缺失值\n","Xtrain.loc[:,cate].isnull().mean()"],"execution_count":98,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Climate        0.0\n","WindGustDir    0.0\n","WindDir9am     0.0\n","WindDir3pm     0.0\n","RainToday      0.0\n","Cloud9am       0.0\n","Cloud3pm       0.0\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":98}]},{"metadata":{"id":"fdr5NdGSJG0N","colab_type":"code","outputId":"46bd6874-f8ab-456f-9c3a-3de3c1964a96","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546771220868,"user_tz":-480,"elapsed":831,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.loc[:,cate].isnull().mean()"],"execution_count":99,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Climate        0.0\n","WindGustDir    0.0\n","WindDir9am     0.0\n","WindDir3pm     0.0\n","RainToday      0.0\n","Cloud9am       0.0\n","Cloud3pm       0.0\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":99}]},{"metadata":{"id":"g2_ykEYpwMkp","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":85},"outputId":"114f3434-fc4a-4146-e7c8-3650c8313167","executionInfo":{"status":"ok","timestamp":1546771312409,"user_tz":-480,"elapsed":905,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest[\"Climate\"].unique()"],"execution_count":100,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array(['Cool temperate', 'Mild temperate', 'Warm temperate',\n","       'Hot dry summer cool winter', 'High humidity summer warm winter',\n","       'Hot dry summer warm winter', 'Warm humid summer mild winter'],\n","      dtype=object)"]},"metadata":{"tags":[]},"execution_count":100}]},{"metadata":{"id":"G6vrQ-8_wKkY","colab_type":"text"},"cell_type":"markdown","source":["## 5 处理分类型变量：将分类型变量编码"]},{"metadata":{"id":"1bWQ9-P7JG0O","colab_type":"code","colab":{}},"cell_type":"code","source":["#将所有的分类型变量编码为数字，一个类别是一个数字\n","from sklearn.preprocessing import OrdinalEncoder #只允许二维以上的数据进行输入\n","oe = OrdinalEncoder()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"H9q1f_cPJG0T","colab_type":"code","colab":{}},"cell_type":"code","source":["#利用训练集进行fit\n","oe = oe.fit(Xtrain.loc[:,cate])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"-IVNkSG4JG0X","colab_type":"code","colab":{}},"cell_type":"code","source":["#用训练集的编码结果来编码训练和测试特征矩阵\n","#在这里如果测试特征矩阵报错，就说明测试集中出现了训练集中从未见过的类别\n","Xtrain.loc[:,cate] = oe.transform(Xtrain.loc[:,cate])\n","Xtest.loc[:,cate] = oe.transform(Xtest.loc[:,cate])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"Ngopugn2JG0Y","colab_type":"code","outputId":"90acf726-21e3-42f6-ffea-98ccdae7a766","colab":{"base_uri":"https://localhost:8080/","height":136},"executionInfo":{"status":"ok","timestamp":1546771324749,"user_tz":-480,"elapsed":537,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cate"],"execution_count":104,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Climate',\n"," 'WindGustDir',\n"," 'WindDir9am',\n"," 'WindDir3pm',\n"," 'RainToday',\n"," 'Cloud9am',\n"," 'Cloud3pm']"]},"metadata":{"tags":[]},"execution_count":104}]},{"metadata":{"id":"7wBfKvKBJG0a","colab_type":"code","outputId":"1478e517-ad67-4282-9035-71a3c222d76e","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546771327688,"user_tz":-480,"elapsed":713,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.loc[:,cate].head()"],"execution_count":105,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Climate</th>\n","      <th>WindGustDir</th>\n","      <th>WindDir9am</th>\n","      <th>WindDir3pm</th>\n","      <th>RainToday</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>1.0</td>\n","      <td>2.0</td>\n","      <td>6.0</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0.0</td>\n","      <td>6.0</td>\n","      <td>4.0</td>\n","      <td>6.0</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4.0</td>\n","      <td>13.0</td>\n","      <td>4.0</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>4.0</td>\n","      <td>8.0</td>\n","      <td>3.0</td>\n","      <td>8.0</td>\n","      <td>0.0</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>2.0</td>\n","      <td>5.0</td>\n","      <td>0.0</td>\n","      <td>6.0</td>\n","      <td>0.0</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   Climate  WindGustDir  WindDir9am  WindDir3pm  RainToday  Cloud9am  Cloud3pm\n","0      1.0          2.0         6.0         0.0        0.0       0.0       7.0\n","1      0.0          6.0         4.0         6.0        0.0       7.0       7.0\n","2      4.0         13.0         4.0         0.0        0.0       1.0       3.0\n","3      4.0          8.0         3.0         8.0        0.0       6.0       6.0\n","4      2.0          5.0         0.0         6.0        0.0       2.0       4.0"]},"metadata":{"tags":[]},"execution_count":105}]},{"metadata":{"id":"ie9TolssJG0e","colab_type":"code","outputId":"edc19490-34e4-49de-8468-2aa884a71299","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546771331056,"user_tz":-480,"elapsed":1048,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.loc[:,cate].head()"],"execution_count":106,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Climate</th>\n","      <th>WindGustDir</th>\n","      <th>WindDir9am</th>\n","      <th>WindDir3pm</th>\n","      <th>RainToday</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0.0</td>\n","      <td>11.0</td>\n","      <td>8.0</td>\n","      <td>11.0</td>\n","      <td>1.0</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>4.0</td>\n","      <td>12.0</td>\n","      <td>12.0</td>\n","      <td>8.0</td>\n","      <td>1.0</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0.0</td>\n","      <td>4.0</td>\n","      <td>3.0</td>\n","      <td>9.0</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>6.0</td>\n","      <td>12.0</td>\n","      <td>13.0</td>\n","      <td>9.0</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4.0</td>\n","      <td>0.0</td>\n","      <td>12.0</td>\n","      <td>0.0</td>\n","      <td>0.0</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   Climate  WindGustDir  WindDir9am  WindDir3pm  RainToday  Cloud9am  Cloud3pm\n","0      0.0         11.0         8.0        11.0        1.0       7.0       7.0\n","1      4.0         12.0        12.0         8.0        1.0       8.0       7.0\n","2      0.0          4.0         3.0         9.0        0.0       7.0       7.0\n","3      6.0         12.0        13.0         9.0        0.0       7.0       7.0\n","4      4.0          0.0        12.0         0.0        0.0       8.0       4.0"]},"metadata":{"tags":[]},"execution_count":106}]},{"metadata":{"id":"HFMjXfKlJG0j","colab_type":"code","outputId":"3c78469b-6214-4bf9-8635-de5546d2823a","colab":{"base_uri":"https://localhost:8080/","height":253},"executionInfo":{"status":"ok","timestamp":1546771382314,"user_tz":-480,"elapsed":814,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":107,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8</td>\n","      <td>1.0</td>\n","      <td>17.5</td>\n","      <td>36.0</td>\n","      <td>0.0</td>\n","      <td>8.8</td>\n","      <td>NaN</td>\n","      <td>2.0</td>\n","      <td>26.0</td>\n","      <td>6.0</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>57.0</td>\n","      <td>NaN</td>\n","      <td>1016.8</td>\n","      <td>1012.2</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>27.5</td>\n","      <td>NaN</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12</td>\n","      <td>0.0</td>\n","      <td>9.5</td>\n","      <td>25.0</td>\n","      <td>0.0</td>\n","      <td>NaN</td>\n","      <td>NaN</td>\n","      <td>6.0</td>\n","      <td>33.0</td>\n","      <td>4.0</td>\n","      <td>...</td>\n","      <td>17.0</td>\n","      <td>59.0</td>\n","      <td>31.0</td>\n","      <td>1020.4</td>\n","      <td>1017.5</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>14.6</td>\n","      <td>23.6</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4</td>\n","      <td>4.0</td>\n","      <td>13.0</td>\n","      <td>22.6</td>\n","      <td>0.0</td>\n","      <td>3.8</td>\n","      <td>10.4</td>\n","      <td>13.0</td>\n","      <td>NaN</td>\n","      <td>4.0</td>\n","      <td>...</td>\n","      <td>31.0</td>\n","      <td>79.0</td>\n","      <td>68.0</td>\n","      <td>1020.3</td>\n","      <td>1015.7</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>17.5</td>\n","      <td>20.8</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11</td>\n","      <td>4.0</td>\n","      <td>13.9</td>\n","      <td>29.8</td>\n","      <td>0.0</td>\n","      <td>5.8</td>\n","      <td>5.1</td>\n","      <td>8.0</td>\n","      <td>37.0</td>\n","      <td>3.0</td>\n","      <td>...</td>\n","      <td>28.0</td>\n","      <td>82.0</td>\n","      <td>44.0</td>\n","      <td>1012.5</td>\n","      <td>1005.9</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>18.5</td>\n","      <td>27.5</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4</td>\n","      <td>2.0</td>\n","      <td>6.0</td>\n","      <td>23.5</td>\n","      <td>0.0</td>\n","      <td>2.8</td>\n","      <td>8.6</td>\n","      <td>5.0</td>\n","      <td>24.0</td>\n","      <td>0.0</td>\n","      <td>...</td>\n","      <td>15.0</td>\n","      <td>58.0</td>\n","      <td>35.0</td>\n","      <td>1019.8</td>\n","      <td>1014.1</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>12.4</td>\n","      <td>22.4</td>\n","      <td>0.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month  Climate  MinTemp  MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0      8      1.0     17.5     36.0       0.0          8.8       NaN   \n","1     12      0.0      9.5     25.0       0.0          NaN       NaN   \n","2      4      4.0     13.0     22.6       0.0          3.8      10.4   \n","3     11      4.0     13.9     29.8       0.0          5.8       5.1   \n","4      4      2.0      6.0     23.5       0.0          2.8       8.6   \n","\n","   WindGustDir  WindGustSpeed  WindDir9am    ...      WindSpeed3pm  \\\n","0          2.0           26.0         6.0    ...              15.0   \n","1          6.0           33.0         4.0    ...              17.0   \n","2         13.0            NaN         4.0    ...              31.0   \n","3          8.0           37.0         3.0    ...              28.0   \n","4          5.0           24.0         0.0    ...              15.0   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0         57.0          NaN       1016.8       1012.2       0.0       7.0   \n","1         59.0         31.0       1020.4       1017.5       7.0       7.0   \n","2         79.0         68.0       1020.3       1015.7       1.0       3.0   \n","3         82.0         44.0       1012.5       1005.9       6.0       6.0   \n","4         58.0         35.0       1019.8       1014.1       2.0       4.0   \n","\n","   Temp9am  Temp3pm  RainToday  \n","0     27.5      NaN        0.0  \n","1     14.6     23.6        0.0  \n","2     17.5     20.8        0.0  \n","3     18.5     27.5        0.0  \n","4     12.4     22.4        0.0  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":107}]},{"metadata":{"id":"kinwvQdhwhto","colab_type":"text"},"cell_type":"markdown","source":["## 6 处理连续型变量：填补缺失值"]},{"metadata":{"id":"Ax4IgNdUJG0o","colab_type":"code","colab":{}},"cell_type":"code","source":["col = Xtrain.columns.tolist()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"jE91ZwjIJG0p","colab_type":"code","outputId":"f6a1b755-e722-4e00-901d-7f6e41002e75","colab":{"base_uri":"https://localhost:8080/","height":391},"executionInfo":{"status":"ok","timestamp":1546771396592,"user_tz":-480,"elapsed":803,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["col"],"execution_count":109,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Month',\n"," 'Climate',\n"," 'MinTemp',\n"," 'MaxTemp',\n"," 'Rainfall',\n"," 'Evaporation',\n"," 'Sunshine',\n"," 'WindGustDir',\n"," 'WindGustSpeed',\n"," 'WindDir9am',\n"," 'WindDir3pm',\n"," 'WindSpeed9am',\n"," 'WindSpeed3pm',\n"," 'Humidity9am',\n"," 'Humidity3pm',\n"," 'Pressure9am',\n"," 'Pressure3pm',\n"," 'Cloud9am',\n"," 'Cloud3pm',\n"," 'Temp9am',\n"," 'Temp3pm',\n"," 'RainToday']"]},"metadata":{"tags":[]},"execution_count":109}]},{"metadata":{"id":"EEIISnhkJG0q","colab_type":"code","outputId":"28e32dd2-589a-4e69-f754-7ecba181920c","colab":{"base_uri":"https://localhost:8080/","height":136},"executionInfo":{"status":"ok","timestamp":1546771416186,"user_tz":-480,"elapsed":864,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cate"],"execution_count":110,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Climate',\n"," 'WindGustDir',\n"," 'WindDir9am',\n"," 'WindDir3pm',\n"," 'RainToday',\n"," 'Cloud9am',\n"," 'Cloud3pm']"]},"metadata":{"tags":[]},"execution_count":110}]},{"metadata":{"id":"nmU-wcDWJG0s","colab_type":"code","colab":{}},"cell_type":"code","source":["for i in cate:\n","    col.remove(i)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"t8DoKWJ5JG0t","colab_type":"code","outputId":"c174104c-8cb5-4978-a607-73931fe97f45","colab":{"base_uri":"https://localhost:8080/","height":272},"executionInfo":{"status":"ok","timestamp":1546771421632,"user_tz":-480,"elapsed":692,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["col"],"execution_count":112,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['Month',\n"," 'MinTemp',\n"," 'MaxTemp',\n"," 'Rainfall',\n"," 'Evaporation',\n"," 'Sunshine',\n"," 'WindGustSpeed',\n"," 'WindSpeed9am',\n"," 'WindSpeed3pm',\n"," 'Humidity9am',\n"," 'Humidity3pm',\n"," 'Pressure9am',\n"," 'Pressure3pm',\n"," 'Temp9am',\n"," 'Temp3pm']"]},"metadata":{"tags":[]},"execution_count":112}]},{"metadata":{"id":"s184R31aJG0u","colab_type":"code","colab":{}},"cell_type":"code","source":["#实例化模型，填补策略为\"mean\"表示均值\n","impmean = SimpleImputer(missing_values=np.nan,strategy = \"mean\")\n","#用训练集来fit模型\n","impmean = impmean.fit(Xtrain.loc[:,col])\n","#分别在训练集和测试集上进行均值填补\n","Xtrain.loc[:,col] = impmean.transform(Xtrain.loc[:,col])\n","Xtest.loc[:,col] = impmean.transform(Xtest.loc[:,col])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"siVKmqDmJG0v","colab_type":"code","outputId":"e0380f5c-507d-47c6-e1e6-2270457c3aba","colab":{"base_uri":"https://localhost:8080/","height":408},"executionInfo":{"status":"ok","timestamp":1546771434717,"user_tz":-480,"elapsed":766,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.isnull().mean()"],"execution_count":114,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Month            0.0\n","Climate          0.0\n","MinTemp          0.0\n","MaxTemp          0.0\n","Rainfall         0.0\n","Evaporation      0.0\n","Sunshine         0.0\n","WindGustDir      0.0\n","WindGustSpeed    0.0\n","WindDir9am       0.0\n","WindDir3pm       0.0\n","WindSpeed9am     0.0\n","WindSpeed3pm     0.0\n","Humidity9am      0.0\n","Humidity3pm      0.0\n","Pressure9am      0.0\n","Pressure3pm      0.0\n","Cloud9am         0.0\n","Cloud3pm         0.0\n","Temp9am          0.0\n","Temp3pm          0.0\n","RainToday        0.0\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":114}]},{"metadata":{"id":"c2IwClRTJG0w","colab_type":"code","outputId":"08ba9204-ce30-4d68-bb92-2b720b83ed2b","colab":{"base_uri":"https://localhost:8080/","height":408},"executionInfo":{"status":"ok","timestamp":1546771439910,"user_tz":-480,"elapsed":683,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.isnull().mean()"],"execution_count":115,"outputs":[{"output_type":"execute_result","data":{"text/plain":["Month            0.0\n","Climate          0.0\n","MinTemp          0.0\n","MaxTemp          0.0\n","Rainfall         0.0\n","Evaporation      0.0\n","Sunshine         0.0\n","WindGustDir      0.0\n","WindGustSpeed    0.0\n","WindDir9am       0.0\n","WindDir3pm       0.0\n","WindSpeed9am     0.0\n","WindSpeed3pm     0.0\n","Humidity9am      0.0\n","Humidity3pm      0.0\n","Pressure9am      0.0\n","Pressure3pm      0.0\n","Cloud9am         0.0\n","Cloud3pm         0.0\n","Temp9am          0.0\n","Temp3pm          0.0\n","RainToday        0.0\n","dtype: float64"]},"metadata":{"tags":[]},"execution_count":115}]},{"metadata":{"id":"nvKpj1Imxaub","colab_type":"text"},"cell_type":"markdown","source":["## 7 处理连续型变量：无量纲化"]},{"metadata":{"id":"Cjn3bUvfJG0z","colab_type":"code","colab":{}},"cell_type":"code","source":["col.remove(\"Month\")\n","# 不对月份进行标准化"],"execution_count":0,"outputs":[]},{"metadata":{"id":"-Dapa-ovJG00","colab_type":"code","outputId":"81c8478e-dbab-488b-fc95-eb50d381816b","colab":{"base_uri":"https://localhost:8080/","height":255},"executionInfo":{"status":"ok","timestamp":1546771649930,"user_tz":-480,"elapsed":703,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["col"],"execution_count":118,"outputs":[{"output_type":"execute_result","data":{"text/plain":["['MinTemp',\n"," 'MaxTemp',\n"," 'Rainfall',\n"," 'Evaporation',\n"," 'Sunshine',\n"," 'WindGustSpeed',\n"," 'WindSpeed9am',\n"," 'WindSpeed3pm',\n"," 'Humidity9am',\n"," 'Humidity3pm',\n"," 'Pressure9am',\n"," 'Pressure3pm',\n"," 'Temp9am',\n"," 'Temp3pm']"]},"metadata":{"tags":[]},"execution_count":118}]},{"metadata":{"id":"4PYlpGgcJG01","colab_type":"code","colab":{}},"cell_type":"code","source":["from sklearn.preprocessing import StandardScaler #数据转换为均值为0，方差为1的数据\n","#标准化不改变数据的分布，不会把数据变成正态分布的"],"execution_count":0,"outputs":[]},{"metadata":{"id":"u57MdTmbJG02","colab_type":"code","colab":{}},"cell_type":"code","source":["ss = StandardScaler()\n","ss = ss.fit(Xtrain.loc[:,col])\n","Xtrain.loc[:,col] = ss.transform(Xtrain.loc[:,col])\n","Xtest.loc[:,col] = ss.transform(Xtest.loc[:,col])"],"execution_count":0,"outputs":[]},{"metadata":{"id":"HBCPxPEmJG03","colab_type":"code","outputId":"91a49ac4-0cd6-4ea1-d6c5-e89753874294","colab":{"base_uri":"https://localhost:8080/","height":253},"executionInfo":{"status":"ok","timestamp":1546771714306,"user_tz":-480,"elapsed":1457,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtrain.head()"],"execution_count":121,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>8.0</td>\n","      <td>1.0</td>\n","      <td>0.826375</td>\n","      <td>1.774044</td>\n","      <td>-0.314379</td>\n","      <td>0.964367</td>\n","      <td>0.000000</td>\n","      <td>2.0</td>\n","      <td>-1.085893e+00</td>\n","      <td>6.0</td>\n","      <td>...</td>\n","      <td>-0.416443</td>\n","      <td>-0.646283</td>\n","      <td>0.000000</td>\n","      <td>-0.122589</td>\n","      <td>-0.453507</td>\n","      <td>0.0</td>\n","      <td>7.0</td>\n","      <td>1.612270</td>\n","      <td>0.000000</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>12.0</td>\n","      <td>0.0</td>\n","      <td>-0.427048</td>\n","      <td>0.244031</td>\n","      <td>-0.314379</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>6.0</td>\n","      <td>-5.373993e-01</td>\n","      <td>4.0</td>\n","      <td>...</td>\n","      <td>-0.182051</td>\n","      <td>-0.539186</td>\n","      <td>-1.011310</td>\n","      <td>0.414254</td>\n","      <td>0.340522</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>-0.366608</td>\n","      <td>0.270238</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>4.0</td>\n","      <td>4.0</td>\n","      <td>0.121324</td>\n","      <td>-0.089790</td>\n","      <td>-0.314379</td>\n","      <td>-0.551534</td>\n","      <td>1.062619</td>\n","      <td>13.0</td>\n","      <td>-1.113509e-15</td>\n","      <td>4.0</td>\n","      <td>...</td>\n","      <td>1.458692</td>\n","      <td>0.531786</td>\n","      <td>0.800547</td>\n","      <td>0.399342</td>\n","      <td>0.070852</td>\n","      <td>1.0</td>\n","      <td>3.0</td>\n","      <td>0.078256</td>\n","      <td>-0.132031</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>11.0</td>\n","      <td>4.0</td>\n","      <td>0.262334</td>\n","      <td>0.911673</td>\n","      <td>-0.314379</td>\n","      <td>0.054826</td>\n","      <td>-0.885225</td>\n","      <td>8.0</td>\n","      <td>-2.239744e-01</td>\n","      <td>3.0</td>\n","      <td>...</td>\n","      <td>1.107105</td>\n","      <td>0.692432</td>\n","      <td>-0.374711</td>\n","      <td>-0.763819</td>\n","      <td>-1.397352</td>\n","      <td>6.0</td>\n","      <td>6.0</td>\n","      <td>0.231658</td>\n","      <td>0.830540</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>4.0</td>\n","      <td>2.0</td>\n","      <td>-0.975421</td>\n","      <td>0.035393</td>\n","      <td>-0.314379</td>\n","      <td>-0.854715</td>\n","      <td>0.401087</td>\n","      <td>5.0</td>\n","      <td>-1.242605e+00</td>\n","      <td>0.0</td>\n","      <td>...</td>\n","      <td>-0.416443</td>\n","      <td>-0.592734</td>\n","      <td>-0.815433</td>\n","      <td>0.324780</td>\n","      <td>-0.168855</td>\n","      <td>2.0</td>\n","      <td>4.0</td>\n","      <td>-0.704091</td>\n","      <td>0.097837</td>\n","      <td>0.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month  Climate   MinTemp   MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0    8.0      1.0  0.826375  1.774044 -0.314379     0.964367  0.000000   \n","1   12.0      0.0 -0.427048  0.244031 -0.314379     0.000000  0.000000   \n","2    4.0      4.0  0.121324 -0.089790 -0.314379    -0.551534  1.062619   \n","3   11.0      4.0  0.262334  0.911673 -0.314379     0.054826 -0.885225   \n","4    4.0      2.0 -0.975421  0.035393 -0.314379    -0.854715  0.401087   \n","\n","   WindGustDir  WindGustSpeed  WindDir9am    ...      WindSpeed3pm  \\\n","0          2.0  -1.085893e+00         6.0    ...         -0.416443   \n","1          6.0  -5.373993e-01         4.0    ...         -0.182051   \n","2         13.0  -1.113509e-15         4.0    ...          1.458692   \n","3          8.0  -2.239744e-01         3.0    ...          1.107105   \n","4          5.0  -1.242605e+00         0.0    ...         -0.416443   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0    -0.646283     0.000000    -0.122589    -0.453507       0.0       7.0   \n","1    -0.539186    -1.011310     0.414254     0.340522       7.0       7.0   \n","2     0.531786     0.800547     0.399342     0.070852       1.0       3.0   \n","3     0.692432    -0.374711    -0.763819    -1.397352       6.0       6.0   \n","4    -0.592734    -0.815433     0.324780    -0.168855       2.0       4.0   \n","\n","    Temp9am   Temp3pm  RainToday  \n","0  1.612270  0.000000        0.0  \n","1 -0.366608  0.270238        0.0  \n","2  0.078256 -0.132031        0.0  \n","3  0.231658  0.830540        0.0  \n","4 -0.704091  0.097837        0.0  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":121}]},{"metadata":{"id":"7JZgn6A1JG05","colab_type":"code","outputId":"53740547-0e12-41ad-abfe-8b1c7d4e4460","colab":{"base_uri":"https://localhost:8080/","height":253},"executionInfo":{"status":"ok","timestamp":1546771718178,"user_tz":-480,"elapsed":904,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Xtest.head()"],"execution_count":122,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Month</th>\n","      <th>Climate</th>\n","      <th>MinTemp</th>\n","      <th>MaxTemp</th>\n","      <th>Rainfall</th>\n","      <th>Evaporation</th>\n","      <th>Sunshine</th>\n","      <th>WindGustDir</th>\n","      <th>WindGustSpeed</th>\n","      <th>WindDir9am</th>\n","      <th>...</th>\n","      <th>WindSpeed3pm</th>\n","      <th>Humidity9am</th>\n","      <th>Humidity3pm</th>\n","      <th>Pressure9am</th>\n","      <th>Pressure3pm</th>\n","      <th>Cloud9am</th>\n","      <th>Cloud3pm</th>\n","      <th>Temp9am</th>\n","      <th>Temp3pm</th>\n","      <th>RainToday</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>1.0</td>\n","      <td>0.0</td>\n","      <td>1.531425</td>\n","      <td>0.633489</td>\n","      <td>2.871067</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>11.0</td>\n","      <td>1.343150</td>\n","      <td>8.0</td>\n","      <td>...</td>\n","      <td>2.161868e+00</td>\n","      <td>1.174369</td>\n","      <td>1.681991</td>\n","      <td>-1.643646</td>\n","      <td>-1.067755</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>1.412848</td>\n","      <td>0.198404</td>\n","      <td>1.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>3.0</td>\n","      <td>4.0</td>\n","      <td>-0.035354</td>\n","      <td>-0.646158</td>\n","      <td>-0.036285</td>\n","      <td>-0.794079</td>\n","      <td>0.107073</td>\n","      <td>12.0</td>\n","      <td>0.951369</td>\n","      <td>12.0</td>\n","      <td>...</td>\n","      <td>1.107105e+00</td>\n","      <td>1.013723</td>\n","      <td>0.506733</td>\n","      <td>0.384430</td>\n","      <td>0.700082</td>\n","      <td>8.0</td>\n","      <td>7.0</td>\n","      <td>-0.335927</td>\n","      <td>-0.606132</td>\n","      <td>1.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>3.0</td>\n","      <td>0.0</td>\n","      <td>-0.489720</td>\n","      <td>-1.383346</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>4.0</td>\n","      <td>0.089450</td>\n","      <td>3.0</td>\n","      <td>...</td>\n","      <td>-4.163637e-16</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>10.0</td>\n","      <td>6.0</td>\n","      <td>0.136992</td>\n","      <td>-0.409702</td>\n","      <td>-0.314379</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>12.0</td>\n","      <td>-0.537399</td>\n","      <td>13.0</td>\n","      <td>...</td>\n","      <td>6.383207e-01</td>\n","      <td>-1.556609</td>\n","      <td>-0.031928</td>\n","      <td>0.548465</td>\n","      <td>0.640155</td>\n","      <td>7.0</td>\n","      <td>7.0</td>\n","      <td>-0.029125</td>\n","      <td>-0.304431</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>11.0</td>\n","      <td>4.0</td>\n","      <td>-0.004018</td>\n","      <td>-0.451429</td>\n","      <td>-0.263817</td>\n","      <td>0.000000</td>\n","      <td>0.000000</td>\n","      <td>0.0</td>\n","      <td>-0.537399</td>\n","      <td>12.0</td>\n","      <td>...</td>\n","      <td>5.234093e-02</td>\n","      <td>1.227917</td>\n","      <td>0.849516</td>\n","      <td>-0.301537</td>\n","      <td>-0.303690</td>\n","      <td>8.0</td>\n","      <td>4.0</td>\n","      <td>-0.520009</td>\n","      <td>-0.390632</td>\n","      <td>0.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5 rows × 22 columns</p>\n","</div>"],"text/plain":["   Month  Climate   MinTemp   MaxTemp  Rainfall  Evaporation  Sunshine  \\\n","0    1.0      0.0  1.531425  0.633489  2.871067     0.000000  0.000000   \n","1    3.0      4.0 -0.035354 -0.646158 -0.036285    -0.794079  0.107073   \n","2    3.0      0.0 -0.489720 -1.383346  0.000000     0.000000  0.000000   \n","3   10.0      6.0  0.136992 -0.409702 -0.314379     0.000000  0.000000   \n","4   11.0      4.0 -0.004018 -0.451429 -0.263817     0.000000  0.000000   \n","\n","   WindGustDir  WindGustSpeed  WindDir9am    ...      WindSpeed3pm  \\\n","0         11.0       1.343150         8.0    ...      2.161868e+00   \n","1         12.0       0.951369        12.0    ...      1.107105e+00   \n","2          4.0       0.089450         3.0    ...     -4.163637e-16   \n","3         12.0      -0.537399        13.0    ...      6.383207e-01   \n","4          0.0      -0.537399        12.0    ...      5.234093e-02   \n","\n","   Humidity9am  Humidity3pm  Pressure9am  Pressure3pm  Cloud9am  Cloud3pm  \\\n","0     1.174369     1.681991    -1.643646    -1.067755       7.0       7.0   \n","1     1.013723     0.506733     0.384430     0.700082       8.0       7.0   \n","2     0.000000     0.000000     0.000000     0.000000       7.0       7.0   \n","3    -1.556609    -0.031928     0.548465     0.640155       7.0       7.0   \n","4     1.227917     0.849516    -0.301537    -0.303690       8.0       4.0   \n","\n","    Temp9am   Temp3pm  RainToday  \n","0  1.412848  0.198404        1.0  \n","1 -0.335927 -0.606132        1.0  \n","2  0.000000  0.000000        0.0  \n","3 -0.029125 -0.304431        0.0  \n","4 -0.520009 -0.390632        0.0  \n","\n","[5 rows x 22 columns]"]},"metadata":{"tags":[]},"execution_count":122}]},{"metadata":{"id":"_Of6Ks5jJG09","colab_type":"code","outputId":"75a45a7e-6df6-4cf8-dac2-75dd36450435","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546771721692,"user_tz":-480,"elapsed":783,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["Ytrain.head()\n","# 标签为dataframe类型，后面要进行降维，成为一维数据"],"execution_count":123,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>1</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["   0\n","0  0\n","1  0\n","2  0\n","3  1\n","4  0"]},"metadata":{"tags":[]},"execution_count":123}]},{"metadata":{"id":"67L-oirEy6N_","colab_type":"text"},"cell_type":"markdown","source":["# 建模与模型评估"]},{"metadata":{"id":"liBadk3pJG0_","colab_type":"code","colab":{}},"cell_type":"code","source":["from time import time #随时监控我们的模型的运行时间\n","import datetime\n","from sklearn.svm import SVC\n","from sklearn.model_selection import cross_val_score\n","from sklearn.metrics import roc_auc_score, recall_score"],"execution_count":0,"outputs":[]},{"metadata":{"id":"8GvwvkYBJG1B","colab_type":"code","colab":{}},"cell_type":"code","source":["Ytrain = Ytrain.iloc[:,0].ravel()\n","Ytest = Ytest.iloc[:,0].ravel()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"8-bEC4h7JG1C","colab_type":"code","outputId":"fb94f63b-4475-4cc7-d686-6d6a187c8538","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546772134985,"user_tz":-480,"elapsed":4491,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["#建模选择自然是我们的支持向量机SVC，首先用核函数的学习曲线来选择核函数\n","#我们希望同时观察，精确性，recall以及AUC分数\n","times = time() #因为SVM是计算量很大的模型，所以我们需要时刻监控我们的模型运行时间\n","\n","for kernel in [\"linear\",\"poly\",\"rbf\",\"sigmoid\"]:\n","    clf = SVC(kernel = kernel\n","              ,gamma=\"auto\"\n","              ,degree = 1\n","              ,cache_size = 5000\n","             ).fit(Xtrain, Ytrain)\n","    \n","    result = clf.predict(Xtest)\n","    score = clf.score(Xtest,Ytest)\n","    \n","    recall = recall_score(Ytest, result)\n","    \n","    auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","    \n","    print(\"%s 's testing accuracy %f, recall is %f, auc is %f\" % (kernel,score,recall,auc))\n","    print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":126,"outputs":[{"output_type":"stream","text":["linear 's testing accuracy 0.844000, recall is 0.469388', auc is 0.869029\n","00:01:203308\n","poly 's testing accuracy 0.840667, recall is 0.457726', auc is 0.868157\n","00:01:657004\n","rbf 's testing accuracy 0.813333, recall is 0.306122', auc is 0.814873\n","00:02:790032\n","sigmoid 's testing accuracy 0.655333, recall is 0.154519', auc is 0.437308\n","00:03:534602\n"],"name":"stdout"}]},{"metadata":{"id":"yCKeSVHT1KlQ","colab_type":"text"},"cell_type":"markdown","source":["# 模型调参"]},{"metadata":{"id":"V2MdPI1n1QRV","colab_type":"text"},"cell_type":"markdown","source":["## 1 追求最高Recall"]},{"metadata":{"id":"LZj5yT7RJG1D","colab_type":"code","outputId":"dcb22320-d77f-472e-f959-17b64b13f61f","colab":{"base_uri":"https://localhost:8080/","height":153},"executionInfo":{"status":"ok","timestamp":1546772149441,"user_tz":-480,"elapsed":5723,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["times = time()\n","for kernel in [\"linear\",\"poly\",\"rbf\",\"sigmoid\"]:\n","    clf = SVC(kernel = kernel\n","              ,gamma=\"auto\"\n","              ,degree = 1\n","              ,cache_size = 5000\n","              ,class_weight = \"balanced\"\n","             ).fit(Xtrain, Ytrain)\n","    result = clf.predict(Xtest)\n","    score = clf.score(Xtest,Ytest)\n","    recall = recall_score(Ytest, result)\n","    auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","    print(\"%s 's testing accuracy %f, recall is %f, auc is %f\" % (kernel,score,recall,auc))\n","    print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":127,"outputs":[{"output_type":"stream","text":["linear 's testing accuracy 0.796667, recall is 0.775510', auc is 0.870062\n","00:01:478248\n","poly 's testing accuracy 0.793333, recall is 0.763848', auc is 0.871448\n","00:02:143905\n","rbf 's testing accuracy 0.803333, recall is 0.600583', auc is 0.819713\n","00:03:417587\n","sigmoid 's testing accuracy 0.562000, recall is 0.282799', auc is 0.437119\n","00:05:055192\n"],"name":"stdout"}]},{"metadata":{"id":"mhzPcMHXJG1F","colab_type":"code","outputId":"ee437fa1-812c-4954-ee33-f264ad4671b1","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546772181957,"user_tz":-480,"elapsed":3836,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["times = time()\n","clf = SVC(kernel = \"linear\"\n","          ,gamma=\"auto\"\n","          ,cache_size = 5000\n","          ,class_weight = {1:15} #注意，这里写的其实是，类别1：10(10为类别1所占的权重)，隐藏了类别0：1这个比例\n","         ).fit(Xtrain, Ytrain)\n","result = clf.predict(Xtest)\n","score = clf.score(Xtest,Ytest)\n","recall = recall_score(Ytest, result)\n","auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","print(\"testing accuracy %f, recall is %f, auc is %f\" %(score,recall,auc))\n","print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":128,"outputs":[{"output_type":"stream","text":["testing accuracy 0.548000, recall is 0.970845', auc is 0.867172\n","00:02:779781\n"],"name":"stdout"}]},{"metadata":{"id":"XSbwuqFw1s4w","colab_type":"text"},"cell_type":"markdown","source":["## 2 追求最高准确率"]},{"metadata":{"id":"PE1Ky8DFJG1I","colab_type":"code","colab":{}},"cell_type":"code","source":["valuec = pd.Series(Ytest).value_counts()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"7r8yYPLiJG1I","colab_type":"code","outputId":"2dbb9bf0-94e2-468d-e2da-cbc16453a9b8","colab":{"base_uri":"https://localhost:8080/","height":68},"executionInfo":{"status":"ok","timestamp":1546772763509,"user_tz":-480,"elapsed":787,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["valuec"],"execution_count":130,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0    1157\n","1     343\n","dtype: int64"]},"metadata":{"tags":[]},"execution_count":130}]},{"metadata":{"id":"Juf7NcAHJG1K","colab_type":"code","outputId":"1763a781-8388-4af2-ac92-c4688ec755a8","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546772766722,"user_tz":-480,"elapsed":727,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["valuec[0]/valuec.sum()"],"execution_count":131,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.7713333333333333"]},"metadata":{"tags":[]},"execution_count":131}]},{"metadata":{"id":"8xs_Yz3LJG1M","colab_type":"code","colab":{}},"cell_type":"code","source":["#查看模型的特异度\n","from sklearn.metrics import confusion_matrix as CM"],"execution_count":0,"outputs":[]},{"metadata":{"id":"f8_z71PBJG1P","colab_type":"code","colab":{}},"cell_type":"code","source":["clf = SVC(kernel = \"linear\"\n","          ,gamma=\"auto\"\n","          ,cache_size = 5000\n","         ).fit(Xtrain, Ytrain)\n","result = clf.predict(Xtest)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"G_uLVUNZJG1R","colab_type":"code","colab":{}},"cell_type":"code","source":["cm = CM(Ytest,result,labels=(1,0))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"cR8BM9zhJG1S","colab_type":"code","outputId":"1cbeb0ea-373f-4c45-a835-7756040fc3dd","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546772788745,"user_tz":-480,"elapsed":960,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["cm"],"execution_count":135,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array([[ 161,  182],\n","       [  52, 1105]])"]},"metadata":{"tags":[]},"execution_count":135}]},{"metadata":{"id":"BtVDaq6MJG1T","colab_type":"code","colab":{}},"cell_type":"code","source":["specificity = cm[1,1]/cm[1,:].sum()"],"execution_count":0,"outputs":[]},{"metadata":{"id":"uiCjt_T_JG1V","colab_type":"code","outputId":"23fb1b03-4874-4bda-c7a2-b6e523de4702","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546772793596,"user_tz":-480,"elapsed":700,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["specificity #几乎所有的0都被判断正确了，还有不少1也被判断正确了"],"execution_count":137,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.9550561797752809"]},"metadata":{"tags":[]},"execution_count":137}]},{"metadata":{"id":"i1hwFOywJG1Z","colab_type":"code","colab":{}},"cell_type":"code","source":["irange = np.linspace(0.01,0.05,10)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"MyTbGAXZJG1a","colab_type":"code","outputId":"59a34f37-ac90-4451-d7e6-5cc1bea63a13","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546773199505,"user_tz":-480,"elapsed":1042,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["irange"],"execution_count":139,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array([0.01      , 0.01444444, 0.01888889, 0.02333333, 0.02777778,\n","       0.03222222, 0.03666667, 0.04111111, 0.04555556, 0.05      ])"]},"metadata":{"tags":[]},"execution_count":139}]},{"metadata":{"id":"KCucj4CqJG1c","colab_type":"code","outputId":"dcfd7742-55dc-4445-f404-c553f2a33e30","colab":{"base_uri":"https://localhost:8080/","height":357},"executionInfo":{"status":"ok","timestamp":1546773313175,"user_tz":-480,"elapsed":12245,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["for i in irange:\n","    times = time()\n","    clf = SVC(kernel = \"linear\"\n","              ,gamma=\"auto\"\n","              ,cache_size = 5000\n","              ,class_weight = {1:1+i}\n","             ).fit(Xtrain, Ytrain)\n","    result = clf.predict(Xtest)\n","    score = clf.score(Xtest,Ytest)\n","    recall = recall_score(Ytest, result)\n","    auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","    print(\"under ratio 1:%f testing accuracy %f, recall is %f', auc is %f\" %(1+i,score,recall,auc))\n","    print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":140,"outputs":[{"output_type":"stream","text":["under ratio 1:1.010000 testing accuracy 0.844667, recall is 0.475219', auc is 0.869157\n","00:01:093370\n","under ratio 1:1.014444 testing accuracy 0.844667, recall is 0.478134', auc is 0.869185\n","00:01:133078\n","under ratio 1:1.018889 testing accuracy 0.844667, recall is 0.478134', auc is 0.869198\n","00:01:114378\n","under ratio 1:1.023333 testing accuracy 0.845333, recall is 0.481050', auc is 0.869175\n","00:01:174231\n","under ratio 1:1.027778 testing accuracy 0.844000, recall is 0.481050', auc is 0.869394\n","00:01:182482\n","under ratio 1:1.032222 testing accuracy 0.844000, recall is 0.481050', auc is 0.869528\n","00:01:127803\n","under ratio 1:1.036667 testing accuracy 0.844000, recall is 0.481050', auc is 0.869659\n","00:01:199376\n","under ratio 1:1.041111 testing accuracy 0.844667, recall is 0.483965', auc is 0.869629\n","00:01:183810\n","under ratio 1:1.045556 testing accuracy 0.844667, recall is 0.483965', auc is 0.869712\n","00:01:182662\n","under ratio 1:1.050000 testing accuracy 0.845333, recall is 0.486880', auc is 0.869863\n","00:01:189984\n"],"name":"stdout"}]},{"metadata":{"id":"fovywo7UJG1g","colab_type":"code","colab":{}},"cell_type":"code","source":["irange_ = np.linspace(0.018889,0.027778,10)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"KItTTrtHJG1i","colab_type":"code","outputId":"bb9b2518-51f4-4bdd-889e-108d2219efe1","colab":{"base_uri":"https://localhost:8080/","height":357},"executionInfo":{"status":"ok","timestamp":1546773438157,"user_tz":-480,"elapsed":12430,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["for i in irange_:\n","    times = time()\n","    clf = SVC(kernel = \"linear\"\n","              ,gamma=\"auto\"\n","              ,cache_size = 5000\n","              ,class_weight = {1:1+i}\n","             ).fit(Xtrain, Ytrain)\n","    result = clf.predict(Xtest)\n","    score = clf.score(Xtest,Ytest)\n","    recall = recall_score(Ytest, result)\n","    auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","    print(\"under ratio 1:%f testing accuracy %f, recall is %f', auc is %f\" %(1+i,score,recall,auc))\n","    print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":142,"outputs":[{"output_type":"stream","text":["under ratio 1:1.018889 testing accuracy 0.844667, recall is 0.478134', auc is 0.869213\n","00:01:162071\n","under ratio 1:1.019877 testing accuracy 0.844000, recall is 0.478134', auc is 0.869228\n","00:01:133713\n","under ratio 1:1.020864 testing accuracy 0.844000, recall is 0.478134', auc is 0.869218\n","00:01:172751\n","under ratio 1:1.021852 testing accuracy 0.844667, recall is 0.478134', auc is 0.869188\n","00:01:124336\n","under ratio 1:1.022840 testing accuracy 0.844667, recall is 0.478134', auc is 0.869220\n","00:01:172664\n","under ratio 1:1.023827 testing accuracy 0.844667, recall is 0.481050', auc is 0.869188\n","00:01:197384\n","under ratio 1:1.024815 testing accuracy 0.844667, recall is 0.481050', auc is 0.869231\n","00:01:111712\n","under ratio 1:1.025803 testing accuracy 0.844000, recall is 0.481050', auc is 0.869253\n","00:01:201388\n","under ratio 1:1.026790 testing accuracy 0.844000, recall is 0.481050', auc is 0.869314\n","00:01:152890\n","under ratio 1:1.027778 testing accuracy 0.844667, recall is 0.481050', auc is 0.869374\n","00:01:211957\n"],"name":"stdout"}]},{"metadata":{"id":"LU-VGviaJG1o","colab_type":"code","colab":{}},"cell_type":"code","source":["from sklearn.linear_model import LogisticRegression as LR"],"execution_count":0,"outputs":[]},{"metadata":{"id":"wI0IRifhJG1o","colab_type":"code","outputId":"2172f023-7e7d-457f-d2dd-dfc532bc1f1b","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546773611105,"user_tz":-480,"elapsed":966,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["logclf = LR(solver=\"liblinear\").fit(Xtrain, Ytrain)\n","logclf.score(Xtest,Ytest)"],"execution_count":144,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.8486666666666667"]},"metadata":{"tags":[]},"execution_count":144}]},{"metadata":{"id":"K0ffVyI1JG1q","colab_type":"code","colab":{}},"cell_type":"code","source":["C_range = np.linspace(5,10,10)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"yXIMfFFTJG1r","colab_type":"code","outputId":"a031a5d6-d93b-4f56-eee4-b59f45f472f4","colab":{"base_uri":"https://localhost:8080/","height":187},"executionInfo":{"status":"ok","timestamp":1546773620953,"user_tz":-480,"elapsed":1059,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["for C in C_range:\n","    logclf = LR(solver=\"liblinear\",C=C).fit(Xtrain, Ytrain)\n","    print(C,logclf.score(Xtest,Ytest))"],"execution_count":146,"outputs":[{"output_type":"stream","text":["5.0 0.8493333333333334\n","5.555555555555555 0.8493333333333334\n","6.111111111111111 0.8486666666666667\n","6.666666666666667 0.8493333333333334\n","7.222222222222222 0.8493333333333334\n","7.777777777777778 0.8493333333333334\n","8.333333333333334 0.8493333333333334\n","8.88888888888889 0.8493333333333334\n","9.444444444444445 0.8493333333333334\n","10.0 0.8493333333333334\n"],"name":"stdout"}]},{"metadata":{"id":"LF77SZq53sEp","colab_type":"text"},"cell_type":"markdown","source":["## 3 追求平衡"]},{"metadata":{"id":"CqbVgrY55066","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":1044},"outputId":"4e3d2e10-5bda-4092-a677-c6d0085a2f8e","executionInfo":{"status":"ok","timestamp":1546774005795,"user_tz":-480,"elapsed":149659,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["import matplotlib.pyplot as plt\n","C_range = np.linspace(0.01,20,20)\n","recallall = []\n","aucall = []\n","scoreall = []\n","for C in C_range:\n","    times = time()\n","    clf = SVC(kernel = \"linear\",C=C,cache_size = 5000\n","            ,class_weight = \"balanced\"\n","            ).fit(Xtrain, Ytrain)\n","    result = clf.predict(Xtest)\n","    score = clf.score(Xtest,Ytest)\n","    recall = recall_score(Ytest, result)\n","    auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","    recallall.append(recall)\n","    aucall.append(auc)\n","    scoreall.append(score)\n","    print(\"under C %f, testing accuracy is %f,recall is %f', auc is %f\" %(C,score,recall,auc))\n","    print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))\n","\n","print(max(aucall),C_range[aucall.index(max(aucall))])\n","plt.figure()\n","plt.plot(C_range,recallall,c=\"red\",label=\"recall\")\n","plt.plot(C_range,aucall,c=\"black\",label=\"auc\")\n","plt.plot(C_range,scoreall,c=\"orange\",label=\"accuracy\")\n","plt.legend()\n","plt.show()"],"execution_count":148,"outputs":[{"output_type":"stream","text":["under C 0.010000, testing accuracy is 0.800000,recall is 0.752187', auc is 0.870634\n","00:00:523332\n","under C 1.062105, testing accuracy is 0.796000,recall is 0.775510', auc is 0.870024\n","00:01:555503\n","under C 2.114211, testing accuracy is 0.794000,recall is 0.772595', auc is 0.870160\n","00:02:507153\n","under C 3.166316, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870165\n","00:02:934146\n","under C 4.218421, testing accuracy is 0.796000,recall is 0.775510', auc is 0.870112\n","00:03:617823\n","under C 5.270526, testing accuracy is 0.796000,recall is 0.775510', auc is 0.870082\n","00:04:132073\n","under C 6.322632, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870100\n","00:05:275516\n","under C 7.374737, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870022\n","00:05:943892\n","under C 8.426842, testing accuracy is 0.796000,recall is 0.775510', auc is 0.870090\n","00:06:095373\n","under C 9.478947, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870123\n","00:07:598509\n","under C 10.531053, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870092\n","00:08:061096\n","under C 11.583158, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870097\n","00:07:830785\n","under C 12.635263, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870019\n","00:08:996435\n","under C 13.687368, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870039\n","00:09:034215\n","under C 14.739474, testing accuracy is 0.795333,recall is 0.772595', auc is 0.869986\n","00:10:094592\n","under C 15.791579, testing accuracy is 0.795333,recall is 0.772595', auc is 0.869997\n","00:10:675077\n","under C 16.843684, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870032\n","00:12:211973\n","under C 17.895789, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870024\n","00:13:153261\n","under C 18.947895, testing accuracy is 0.795333,recall is 0.772595', auc is 0.870014\n","00:13:658839\n","under C 20.000000, testing accuracy is 0.794667,recall is 0.772595', auc is 0.870047\n","00:14:823682\n","0.8706340666900172 0.01\n"],"name":"stdout"},{"output_type":"display_data","data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAecAAAFKCAYAAAAnj5dkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl8VPW9//HXmS0hKxlMABEFqQpG\nUTBuIKg0UVm0eusCLYKVXpficr1YioCGtoobtvqTWlGxVUSMC/UiuwvuCAiKJopLbAFZE0gCQ9aZ\nOb8/Bobsk+CEOTm8n49HHpOzzJnvZ86Zec/5njNnDNM0TURERMQyHLFugIiIiNSlcBYREbEYhbOI\niIjFKJxFREQsRuEsIiJiMQpnERERi3HFugEHFBXtjery0tISKCkpj+oyY8UutdilDlAtVmWXWuxS\nB6iW5qSnJzc5zbZ7zi6XM9ZNiBq71GKXOkC1WJVdarFLHaBaDpVtw1lERKS9UjiLiIhYjMJZRETE\nYhTOIiIiFqNwFhERsRiFs4iIiMUonEVERCxG4SwiImIxCmcRERGLUTiLiIhYjGWurR1Na9as4ttv\n83E640lN7UjHjh3DtykpqSQmJmIYRqybKSIi0ihbhvPdd09i3bq1TU53u92kpqbWCeyDAZ5GamrH\nOtMPzJOUlEwwGCQQ8BMIBPD7/QQCfvz+QL1hP4FAMPy/3+8nGAzg9x+c5+D8AUzTbLSdB8YnJ8ez\nd29lo9OaYxgGDocDwzDCf7WHD/zvcDiAusOhW6PWfesu58DfgcdpbDzUHgdebxIlJfsanbd2PQf+\nb/q28fn2j61VvwOHw8DpdOJwOPbX5Qj/f3C8UWf8gWl1x4WeF9M0CQaDQCU7d+7BNIMEgwf/DkwP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atWq6LVYRETE5iKG8+rVq9m4cSN5eXncd999\ndQLY5/Mxe/Zs5s6dy7x58ygsLOTzzz8PT3/ooYfo3r1727RcRETEpiKG88qVK8nOzgagV69elJWV\n4fP5AHC73bjdbsrLy/H7/VRUVJCamhq+X2JiIieeeGIbNl9ERMR+IoZzcXExaWlp4WGv10tRUREA\ncXFxjB8/nuzsbC688EJOO+00evbsSXV1NX/729+444472q7lIiIiNuVq7R1M0wz/7/P5mDVrFkuX\nLiUpKYmxY8eyYcMG3nrrLa666ipSUlJavNy0tARcLmdrm9Os9PTkqC4vluxSi13qANViVXapxS51\ngGo5FBHDOSMjg+Li4vDwzp07SU9PB6CwsJDu3bvj9XoByMrKIj8/nw8//JBgMMjcuXPZtGkTX3zx\nBY899hgnnHBCk49TUlL+U2upIz09maKivVFdZqzYpRa71AGqxarsUotd6gDVEml5TYnYrT1w4ECW\nLVsGQEFBARkZGSQlJQHQrVs3CgsLqaysBCA/P58ePXrw0ksv8fLLL/Pyyy9zwQUXkJub22wwi4iI\nyEER95z79+9PZmYmI0eOxDAMcnNzmT9/PsnJyeTk5DBu3DjGjBmD0+mkX79+ZGVlHY52i4iI2JZh\n1j6IHEPR7vZQV4r12KUOUC1WZZda7FIHqJZIy2uKrhAmIiJiMQpnERERi1E4i4iIWIzCWURExGIU\nziIiIhajcBYREbEYhbOIiIjFKJxFREQsRuEsIiJiMQpnERERi1E4i4iIWIzCWURExGIUziIiIhaj\ncBYREbEYhbOIiIjFKJxFREQsRuEsIiJiMQpnERERi1E4i4iIWIzCWURExGIUziIiIhajcBYREbEY\nhbOIiIjFKJxFREQsRuEsIiJiMQpnERERi1E4i4iIWIzCWURExGIUziIiIhajcBYREbEYhbOIiIjF\nKJxFREQsRuEsIiJiMQpnERERi1E4i4iIWIzCWURExGIUziIiIhbjaslM06dPZ/369RiGweTJk+nb\nt2942ty5c1mwYAEOh4NTTjmFKVOm4Pf7mTJlCps2bSIQCDBx4kSysrLarAgRERE7iRjOq1evZuPG\nje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1lERMRiFM4iIiIWo3AWERGxGIWziIiIxSicRURELEbhLCIiYjHt/vecp0+fzvr1\n6zEMg8mTJ9O3b9/wtI8//pi//OUvOJ1OBg8ezPjx42PY0sgeeugh1q5di9/v58Ybb+Siiy4KTxsy\nZAhdunTB6XQCMGPGDDp37hyrpjZr1apV3H777ZxwwgkAnHjiidx9993h6e1pvbzyyissWLAgPJyf\nn89nn30WHs7MzKR///7h4X/+85/hdWQV3377Lb/73e+47rrrGD16NNu2bWPixIkEAgHS09N5+OGH\n8Xg8de7T3OsqVhqr46677sLv9+NyuXj44YdJT08Pzx9pO4yl+rVMmjSJgoICOnbsCMC4ceO44IIL\n6tzHiusEGtZy2223UVJSAkBpaSmnn346f/7zn8Pzz58/n8cee4xjjz0WgAEDBnDzzTfHpO311X8P\nPvXUU2P3WjHbsVWrVpk33HCDaZqm+f3335tXX311nelDhw41t27dagYCAXPUqFHmd999F4tmtsjK\nlSvN3/72t6Zpmubu3bvN888/v870Cy+80PT5fDFoWet98skn5q233trk9Pa0XmpbtWqVOW3atDrj\nzjrrrBi1pmX27dtnjh492pw6dao5Z84c0zRNc9KkSebixYtN0zTNRx55xJw7d26d+0R6XcVCY3VM\nnDjRXLRokWmapvnCCy+YDz74YJ37RNoOY6WxWv7whz+Y77zzTpP3seI6Mc3Ga6lt0qRJ5vr16+uM\ne+2118wHHnjgcDWxxRp7D47la6Vdd2uvXLmS7OxsAHr16kVZWRk+nw+AzZs3k5qaSteuXXE4HJx/\n/vmsXLkyls1t1plnnsljjz0GQEpKChUVFQQCgRi3Kvra23qp7W9/+xu/+93vYt2MVvF4PDz99NNk\nZGSEx61atYqf//znAFx44YUNnv/mXlex0lgdubm5XHzxxQCkpaVRWloaq+a1SmO1RGLFdQLN1/LD\nDz+wd+9ey+zhR9LYe3AsXyvtOpyLi4tJS0sLD3u9XoqKigAoKirC6/U2Os2KnE4nCQkJALz66qsM\nHjy4Qfdobm4uo0aNYsaMGZgWv7Db999/z0033cSoUaP46KOPwuP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nY8YMAC666CLGjRsX49Y2LS8vj8cff5yePXuGx5199tmcdNJJ5OTk8Nxzz/H6668TFxfHySefzN13\n341hGDFscdN8Ph933nkne/bsoaamhltuuYVdu3a1y/UCoa9PPfroozzzzDMAPPXUU5x55pn069eP\nhx9+mE8++QSHw8GQIUMs85WQA/Lz83nwwQfZsmULLpeLzp07M2PGDCZNmkRVVRVHH300999/P263\nmzvuuIP777+f+Pj4Bq+rpt5oY1nHrl27iIuLC78Z9urVi2nTpoXr8Pv9DbbD888/P6Z1QOO1jB49\nmqeeeooOHTqQkJDA/fffT6dOnSy9Tpqq5fHHH+fxxx/njDPOYNiwYeF5b775Zv7+97+zfft2fv/7\n34c/1Frla2GNvQc/8MADTJ06NSavlXYfziIiInbTrru1RURE7EjhLCIiYjEKZxEREYtROIuIiFiM\nwllERMRiFM4iIiIWo3AWERGxGIWziIiIxfx/rWUcHdcKcK0AAAAASUVORK5CYII=\n","text/plain":["<matplotlib.figure.Figure at 0x7ff58b7aedd8>"]},"metadata":{"tags":[]}}]},{"metadata":{"id":"j-V4Wc-1JG1t","colab_type":"code","outputId":"5134ba0a-68a5-4441-9a6a-7d6abeafa35a","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546773787978,"user_tz":-480,"elapsed":3699,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["times = time()\n","clf = SVC(kernel = \"linear\",C=3.1663157894736838,cache_size = 5000\n","          ,class_weight = \"balanced\"\n","         ).fit(Xtrain, Ytrain)\n","result = clf.predict(Xtest)\n","score = clf.score(Xtest,Ytest)\n","recall = recall_score(Ytest, result)\n","auc = roc_auc_score(Ytest,clf.decision_function(Xtest))\n","print(\"testing accuracy %f,recall is %f', auc is %f\" % (score,recall,auc))\n","print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":147,"outputs":[{"output_type":"stream","text":["testing accuracy 0.795333,recall is 0.772595', auc is 0.870165\n","00:02:857634\n"],"name":"stdout"}]},{"metadata":{"id":"xbWuGHQn63yq","colab_type":"text"},"cell_type":"markdown","source":["## 绘制ROC曲线"]},{"metadata":{"id":"3Lq43kjTJG1u","colab_type":"code","colab":{}},"cell_type":"code","source":["from sklearn.metrics import roc_curve as ROC\n","import matplotlib.pyplot as plt"],"execution_count":0,"outputs":[]},{"metadata":{"id":"mtVfeCHPJG10","colab_type":"code","colab":{}},"cell_type":"code","source":["FPR, Recall, thresholds = ROC(Ytest,clf.decision_function(Xtest),pos_label=1)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"TXXxuh65JG11","colab_type":"code","colab":{}},"cell_type":"code","source":["area = roc_auc_score(Ytest,clf.decision_function(Xtest))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"aWZMxG8AJG13","colab_type":"code","outputId":"c7d25ab0-5ac5-4021-acfc-f3e1f585f87e","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546774105923,"user_tz":-480,"elapsed":629,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["area"],"execution_count":152,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.8700469445711363"]},"metadata":{"tags":[]},"execution_count":152}]},{"metadata":{"id":"xp7cFZIVJG15","colab_type":"code","outputId":"73dafab9-8c0c-446d-e559-46afc8bd74bb","colab":{"base_uri":"https://localhost:8080/","height":376},"executionInfo":{"status":"ok","timestamp":1546774109661,"user_tz":-480,"elapsed":714,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["plt.figure()\n","plt.plot(FPR, Recall, color='red',\n","         label='ROC curve (area = %0.2f)' % area)\n","plt.plot([0, 1], [0, 1], color='black', linestyle='--')\n","plt.xlim([-0.05, 1.05])\n","plt.ylim([-0.05, 1.05])\n","plt.xlabel('False Positive Rate')\n","plt.ylabel('Recall')\n","plt.title('Receiver operating characteristic example')\n","plt.legend(loc=\"lower right\")\n","plt.show()"],"execution_count":153,"outputs":[{"output_type":"display_data","data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAe8AAAFnCAYAAACPasF4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzs3XdclXX/x/HXYSqCCAZabi3NkWbu\nVFQcYGqaWWKu1MxNzlDClVtzgbPu0tZtjmjYcJSzcpQ50spKE1EcCKgguOD6/eHN+YmpoXC4OPB+\nPh494nCuc50PXy94n++4rstiGIaBiIiI2A0HswsQERGRe6PwFhERsTMKbxERETuj8BYREbEzCm8R\nERE7o/AWERGxMwpvyRGVKlWiZcuWBAYGEhgYSMuWLQkNDSU5OTnb32vjxo2MGTMm2/drtv379/P7\n778D8MEHHzBv3jybv2elSpU4ffq0zd/nVkePHuXHH3+859fNnj2bFStW3HWb7du3ExMTk+ntc7PR\no0ezaNEis8sQEziZXYDkH++//z7FixcH4OrVqwwbNoylS5cybNiwbH2fli1b0rJly2zdZ27w8ccf\nU6tWLR599FG6detmdjk29c0333D9+nXq1KlzT68bMWLEv26zfPlyBgwYwEMPPZSp7UVyI/W8xRQu\nLi40btyY3377DbgR5pMnTyYgIAB/f3+WLFli3fbgwYN07NiRgIAAunXrRnR0NAB//fUX3bp1IyAg\ngHbt2vHLL78AEBkZyYsvvsjWrVtp165dhvdt374927Zt4+LFi4waNYqAgACaN2/Oxx9/bN2mUqVK\nLF26lICAAFJTUzO8/sqVK4wbN46AgABat27N9OnTrdtUqlSJ9957j/bt29OgQYMMPbqVK1cSGBiI\nv78/w4cP5/Lly8CNntO0adNo164dX3/9NSkpKQwdOtTaDjNmzABgxYoVfPbZZ8yaNYtly5YRERHB\na6+9BkD37t1ZtmwZXbp0oXHjxgwfPpz0ay9FRkbSsGFDnn76aSI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EBAoXLmx9fGt4pu87va3S\n0tJISUlh2rRp7Nq1C4ALFy5k+MBz8/vGx8czadIkfv31VywWC+fOnaNnz54AnD9/PsO/780/R7p7\nab90zs7OLF++nCVLlhAREUGlSpUYP378HacN7nSc3a6W2x2nAIUKFaJ169YsX748Q/CvXbuW9957\nj0uXLpGWlmad0oAbbVqgQAEAHBwccHNzy/Bc+pRM4cKFsVgs1q8B6zRF+teZ+X2QvEPhLTnO29ub\n7t27M2vWLBYvXgyAr68vvXv3plmzZhm2/fvvvzl//jxpaWk4ODhw7do1zpw5g6+vL4UKFWLdunX/\n2H9kZKT168aNGxMaGsqxY8c4duwY9evXt77fwoULrb3NzHrggQcy/EE8f/48DzzwgPVxQkICJUqU\nsD7n6emJr68vzzzzDCEhIf+6/9dff52qVauycOFCHB0dCQoKuqf6bubu7p5hNX96L+5WXl5eJCQk\nWB+npKRw4cIF6+LC23n33Xc5duwYkZGRFCpUiLlz53LmzJnbbjt37lycnJxYu3YtLi4uGRaJFSlS\nhISEBEqWLAncmAe+9UPGvbTfzapUqUJ4eDhXr17lP//5D+PHj+ejjz667bZeXl63Pc7S67q5ltsd\npwBnzpxh7dq1tGnThgULFhASEsKZM2cICwtj9erVVK5cmWPHjhEQEHBPPweQ4Zi7cOECkPED5t1+\nHyRv0rC5mKJXr17s3buX3bt3A9C8eXNWr15NamoqhmGwaNEitm3bRtmyZSlevLh1aHLNmjWMGzeO\nEiVKULx4cesfq/j4eIYPH/6PU89cXFxo1KgRs2bNonnz5tbeo7+/v/UP+fXr15k6dSqHDh3617qb\nNm3KmjVrSE1NJTk5mc8++8w61Arw5ZdfAnDkyBGioqKoUaMG/v7+bNiwgfj4eODG8P2bb7552/3H\nxcVRuXJlHB0d+f7774mKirL+TE5OTiQmJmaugYGqVaty+PBhoqKiSEtLY82aNbfdrlatWsTGxnLg\nwAEAFi1axMKFC++677i4OMqXL0+hQoU4efIkW7duveNpf3FxcVSsWBEXFxd+//139u7da93W39+f\nTz75BLix4Kpjx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jw\niNnliIiICdTzzuXi4+Po378Pe/b8CED58hVYs+YzBbeISD6mnncu9uWXaxk1aijnzsXi6OhIrVp1\nzC5JRERyAYV3LhQfH0do6KtERq7G1dWVceMmMWDAYLPLEhGRXELhncv88st+unTpxNmzZ6hVqzbz\n5y+mYsVKZpclIiK5iMI7lylXrgKenp706zeIAQMG4+SkfyIREclIyZALbNjwNZcuXeKZZzrh7u7O\nli07cHZ2NrssERHJpRTeJjp/PoGwsNGsWrWCokWLEhDwFG5ubgpuERG5K50qZpJvvlmPn199Vq1a\nQY0aNYmM/BI3NzezyxIRETugnncOu3z5MiEhw1mx4gOcnZ0ZPTqMIUOGqbctIiKZpvDOYa6ursTE\nnKRatepERCyhatVqZpckIiJ2RuGdAxITL/LNNxt45plOWCwWli59Bw+Pwupti4jIfdGct41t2bIJ\nP7/69OvXm927dwHg7V1UwS0iIvdN4W0jSUmJjBjxCs8/34EzZ04zYkQIjz9e0+yyREQkD9CwuQ1s\n27aFYcMGEx19nMqVqxIRsZjq1R83uywREckj1PO2gU2bviEm5iTDh49i48atCm4REclW6nlnk717\n91CjRk0cHBwICXmNZ599jsceq2F2WSIikgep551FSUlJjB49goCAZrzzzpsAFCxYUMEtIiI2o553\nFvzww3cEBw/k+PFjVKr0qO63LSIiOUI97/tw6dIlXnvtVTp0eIoTJ44zZMgwNm7cRs2atcwuTURE\n8gH1vO/Dt99u4K23lvDIIxUJD1+sHreIiOSofBnehSaEQVQUlCqd6dckJyeTlpaKu7sH7dp1IDx8\nMR06PEuBAgVsWKmIiMg/5cthc9e1nwJwpV2HTG2/a9dO/P0bEhY2GgCLxUJQUFcFt4iImCJfhjcA\nZcpwacLku26SkpLCuHGhPP10AH//fZQiRbxIS0vLoQJFRERuL18Om2fGjz/uIjh4AEeO/EX58hWY\nP38x9erVN7ssERERhfftnDlzho4d23L16lX69RvEmDFjcXNzM7ssERERQOGdwbVr13B2dqZYsWJM\nnDiVKlWqUr/+k2aXJSJyV6dOxdCjRxCVKj0K3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lO3bt+Pp6cng\nwYOJjo4mLCyM0aNHm5axZMyYMURFRZGUlERmZiYjR45ErVaTnZ1NdXU1GzZsAK7ch7y8vBxfX1+z\n9T/55BNycnJQFIXjx48zZcoU4uPjAbjvvvtITk6mrq6OysrKJp8xfbN5CHE3kOYtRAu53jnvhQsX\nMmbMGMLDw8nPz2fmzJlm4y4uLrz33nvk5eWZjpq3bduGs7Mzs2fPZuTIkRa3e/U576upVCqz14qi\nmN5bv349BQUFfPXVV0RHR5Oenn7D3+/3C9hyc3P57LPPSExMBMDZ2Zn09HSzZxw35epz3jNnzqRD\nhw6mo/NFixaxbNkyBgwYwN69e3nrrbeuWf9m8xDibiBfFRPCysrKynjwwQcB2LVrF/X19WbjR48e\n5cMPPyQwMJA5c+YQGBjIqVOn6NOnj+mj9MbGRlatWnXNUbslnTp1ory8nLNnzwKwf/9+HnnkEQoL\nC3n77bfp0qUL06dPJyws7JpnOqtUKi5fvnzNnOPGjeP999/n4sWLpqvPr66zoqKClStX3rA2nU5H\neno658+fN8uooaGBzMxMU0YqlQqj0XjNdv5MHkLYE2neQljZ9OnTWbRoEbGxsfTp0wdPT09Wr15t\nGr///vvZvXs3kZGRTJkyhTZt2tC7d28mTZqEm5sbWq2WiIgIPDw8aNu27U1v19XVlZUrV7JgwQIm\nT57M/v37mT9/Pr6+vhw/fpzw8HCmTp1KcXExI0aMMFt30KBB6HQ69uzZY/b+iBEj+PTTTxkzZozp\nvcWLF/P5558zceJE4uPj6d+//w1ra9++PXFxcTz//PMAxMXFMXXqVGbOnMmECRM4d+4cb7/9Nn37\n9kWv15OWltbsPISwJ/JUMSGEEMLOyJG3EEIIYWekeQshhBB2Rpq3EEIIYWekeQshhBB2Rpq3EEII\nYWekeQshhBB2Rpq3EEIIYWekeQshhBB25v8AzF5JfAnne6IAAAAASUVORK5CYII=\n","text/plain":["<matplotlib.figure.Figure at 0x7ff58b7ae400>"]},"metadata":{"tags":[]}}]},{"metadata":{"id":"TrUqcwHFJG16","colab_type":"code","colab":{}},"cell_type":"code","source":["maxindex = (Recall - FPR).tolist().index(max(Recall - FPR))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"InIGcbW37AWJ","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":34},"outputId":"6a4080f5-8cb3-459c-ab59-20cee6457acd","executionInfo":{"status":"ok","timestamp":1546774126646,"user_tz":-480,"elapsed":639,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["maxindex"],"execution_count":155,"outputs":[{"output_type":"execute_result","data":{"text/plain":["198"]},"metadata":{"tags":[]},"execution_count":155}]},{"metadata":{"id":"ogzsCxPEJG19","colab_type":"code","outputId":"b39cd674-858f-4106-9f74-f5f4fd6b1c53","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546774134395,"user_tz":-480,"elapsed":744,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["thresholds[maxindex]"],"execution_count":156,"outputs":[{"output_type":"execute_result","data":{"text/plain":["-0.04892869876744821"]},"metadata":{"tags":[]},"execution_count":156}]},{"metadata":{"id":"0zmjb1dwJG1-","colab_type":"code","colab":{}},"cell_type":"code","source":["from sklearn.metrics import accuracy_score as AC"],"execution_count":0,"outputs":[]},{"metadata":{"id":"rejIQnMrJG1_","colab_type":"code","colab":{}},"cell_type":"code","source":["clf = SVC(kernel = \"linear\",C=3.1663157894736838,cache_size = 5000\n","          ,class_weight = \"balanced\"\n","         ).fit(Xtrain, Ytrain)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"qdDsbsn6JG1_","colab_type":"code","colab":{}},"cell_type":"code","source":["prob = pd.DataFrame(clf.decision_function(Xtest))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"j7JIPvgGJG2A","colab_type":"code","outputId":"2d1a907f-ab0c-4055-a7c2-14c2b7eeaf38","colab":{"base_uri":"https://localhost:8080/","height":204},"executionInfo":{"status":"ok","timestamp":1546774271084,"user_tz":-480,"elapsed":680,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["prob.head()"],"execution_count":160,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2.189193</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0.373116</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>-0.015488</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>-1.136262</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>-0.240851</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["          0\n","0  2.189193\n","1  0.373116\n","2 -0.015488\n","3 -1.136262\n","4 -0.240851"]},"metadata":{"tags":[]},"execution_count":160}]},{"metadata":{"id":"FsyOy9jXJG2B","colab_type":"code","colab":{}},"cell_type":"code","source":["prob.loc[prob.iloc[:,0] >= thresholds[maxindex],\"y_pred\"]=1\n","prob.loc[prob.iloc[:,0] < thresholds[maxindex],\"y_pred\"]=0"],"execution_count":0,"outputs":[]},{"metadata":{"id":"o05NEWwq7o_W","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":204},"outputId":"fe7746bf-d406-44c4-9f86-9df71e710821","executionInfo":{"status":"ok","timestamp":1546774289778,"user_tz":-480,"elapsed":650,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["prob.head()"],"execution_count":162,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","      <th>y_pred</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2.189193</td>\n","      <td>1.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0.373116</td>\n","      <td>1.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>-0.015488</td>\n","      <td>1.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>-1.136262</td>\n","      <td>0.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>-0.240851</td>\n","      <td>0.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["          0  y_pred\n","0  2.189193     1.0\n","1  0.373116     1.0\n","2 -0.015488     1.0\n","3 -1.136262     0.0\n","4 -0.240851     0.0"]},"metadata":{"tags":[]},"execution_count":162}]},{"metadata":{"id":"pZwQ6CpeJG2G","colab_type":"code","outputId":"5f5a1476-5a9c-4794-8ade-9cfd0d81188f","colab":{"base_uri":"https://localhost:8080/","height":34},"executionInfo":{"status":"ok","timestamp":1546774293656,"user_tz":-480,"elapsed":680,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["prob.loc[:,\"y_pred\"].isnull().sum()"],"execution_count":163,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0"]},"metadata":{"tags":[]},"execution_count":163}]},{"metadata":{"id":"ox_gJ6dZJG2H","colab_type":"code","outputId":"f4072c24-f3c5-42ab-ccd5-429ad1f2f371","colab":{"base_uri":"https://localhost:8080/","height":51},"executionInfo":{"status":"ok","timestamp":1546774299879,"user_tz":-480,"elapsed":631,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["times = time()\n","score = AC(Ytest,prob.loc[:,\"y_pred\"].values)\n","recall = recall_score(Ytest, prob.loc[:,\"y_pred\"])\n","print(\"testing accuracy %f,recall is %f\" % (score,recall))\n","print(datetime.datetime.fromtimestamp(time()-times).strftime(\"%M:%S:%f\"))"],"execution_count":164,"outputs":[{"output_type":"stream","text":["testing accuracy 0.793333,recall is 0.793003\n","00:00:005052\n"],"name":"stdout"}]},{"metadata":{"id":"PAyze8YH8ZbS","colab_type":"text"},"cell_type":"markdown","source":["# dataframe只有1列数据时也是二维数据"]},{"metadata":{"id":"ch5GSJ_LJG2I","colab_type":"code","colab":{}},"cell_type":"code","source":["probcs = pd.DataFrame(clf.decision_function(Xtest))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"BWXxTXdo75t5","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":204},"outputId":"f8085bc5-9c29-448c-8c03-b6682d28c083","executionInfo":{"status":"ok","timestamp":1546774374660,"user_tz":-480,"elapsed":658,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["probcs.head()"],"execution_count":167,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>0</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>2.189193</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>0.373116</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>-0.015488</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>-1.136262</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>-0.240851</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>"],"text/plain":["          0\n","0  2.189193\n","1  0.373116\n","2 -0.015488\n","3 -1.136262\n","4 -0.240851"]},"metadata":{"tags":[]},"execution_count":167}]},{"metadata":{"id":"q2mZ_wpI77ft","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":34},"outputId":"5fa95a93-6fd2-4130-a192-43462d8da55c","executionInfo":{"status":"ok","timestamp":1546774442293,"user_tz":-480,"elapsed":656,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["probcs.values.shape"],"execution_count":170,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(1500, 1)"]},"metadata":{"tags":[]},"execution_count":170}]},{"metadata":{"id":"JeuhUo_a8CWM","colab_type":"code","colab":{}},"cell_type":"code","source":["probcs2 =clf.decision_function(Xtest)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"m1BqawmV8o10","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":51},"outputId":"9953cf79-c909-44de-e296-6d0366d9eb19","executionInfo":{"status":"ok","timestamp":1546774560639,"user_tz":-480,"elapsed":1263,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["probcs2"],"execution_count":172,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array([ 2.18919301,  0.37311608, -0.01548812, ..., -1.55974682,\n","        0.06325694,  1.33363018])"]},"metadata":{"tags":[]},"execution_count":172}]},{"metadata":{"id":"hlAmia008rlS","colab_type":"code","colab":{}},"cell_type":"code","source":["probcs3 = pd.Series(clf.decision_function(Xtest))"],"execution_count":0,"outputs":[]},{"metadata":{"id":"TkeGuYgi85lT","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":1071},"outputId":"a7bb418b-5a88-4b98-9206-9ac1d62dcd24","executionInfo":{"status":"ok","timestamp":1546774626643,"user_tz":-480,"elapsed":1130,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["probcs3"],"execution_count":174,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0       2.189193\n","1       0.373116\n","2      -0.015488\n","3      -1.136262\n","4      -0.240851\n","5      -1.917667\n","6      -1.593002\n","7       1.508707\n","8      -0.939971\n","9       3.081288\n","10     -0.209377\n","11      4.118457\n","12     -0.847167\n","13     -1.024524\n","14     -2.517159\n","15     -1.724186\n","16      0.030939\n","17      1.629406\n","18      0.881259\n","19      0.722849\n","20     -0.078500\n","21      0.035607\n","22     -2.167313\n","23     -0.560086\n","24     -0.995842\n","25     -0.448808\n","26     -0.912187\n","27     -0.520494\n","28     -0.608048\n","29     -0.004033\n","          ...   \n","1470    2.051443\n","1471   -0.322513\n","1472   -0.105433\n","1473   -0.919449\n","1474   -1.368898\n","1475    1.910553\n","1476    1.229059\n","1477    0.753579\n","1478    0.174073\n","1479   -0.586445\n","1480   -2.684478\n","1481   -1.783751\n","1482    1.063512\n","1483   -0.520426\n","1484    0.570712\n","1485   -0.766045\n","1486    1.427197\n","1487   -2.561683\n","1488   -0.315142\n","1489   -2.763501\n","1490    0.142289\n","1491   -2.241798\n","1492   -1.455578\n","1493   -1.071879\n","1494    1.193491\n","1495   -0.279249\n","1496   -2.310558\n","1497   -1.559747\n","1498    0.063257\n","1499    1.333630\n","Length: 1500, dtype: float64"]},"metadata":{"tags":[]},"execution_count":174}]},{"metadata":{"id":"XLKtGdPH87vT","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":34},"outputId":"726e69d3-f249-40be-c480-1bf280e23c98","executionInfo":{"status":"ok","timestamp":1546774646195,"user_tz":-480,"elapsed":1031,"user":{"displayName":"Sen Yang","photoUrl":"","userId":"00832503676208839570"}}},"cell_type":"code","source":["probcs3.values.shape"],"execution_count":175,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(1500,)"]},"metadata":{"tags":[]},"execution_count":175}]},{"metadata":{"id":"Qz4OT0VS9AiZ","colab_type":"code","colab":{}},"cell_type":"code","source":[""],"execution_count":0,"outputs":[]}]}